Closed TodePond closed 4 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated (UTC) |
---|---|---|---|
examples | ✅ Ready (Inspect) | Visit Preview | Feb 16, 2024 1:49pm |
viewport / page?
viewport / page?
as props? yes that would be good. im planning to add some props for things like page, background, etc
Riding in some changes here Lu:
There seems to be a problem with text measurement, not sure if this is particular to this project or to tldraw in general.
Kind of an unusual add here, but we didn't have the ability to zoom to a specific bounds without also adding an inset. I've combined the inset property with the animations object on zoomToBounds
. This is pretty obscure (usually called via methods like zoomToSelection
) and I think would have been considered a bug for anyone calling it directly.
Added format option for SVG or PNG.
Text measurements are wrong because the container is not getting tldraw's styles mounted to it.
The text issues should be fixed now. When we do text measurement, we mount the measurement div into the container, so the container needs to have our styles on it.
nice one, thanks for the changes Steve. Looks good
This PR adds the
TldrawImage
component that displays a tldraw snapshot as an SVG image.Why
We've seen requests for this kind of thing from users. eg: GitBook, and on discord:
The component provides a way to do that. This PR also untangles various bits of editor state from image exporting, which makes it easier for library users to export images more agnostically. (ie: they can now export any shapes on any page in any theme. previously, they had to change the user's state to do that).
What else
isDarkMode
property to thetoSvg
method (inside thectx
argument). This means thattoSvg
doesn't have to rely on editor state anymore. I updated all ourtoSvg
methods to use it.Any issues?
When you toggle to editing mode in the new example, text measurements are initially wrong (until you edit the size of a text shape). Click on the text shape to see how its indicator is wrong. Not sure why this is, or if it's even related. Does it ring a bell with anyone? If not, I'll take a closer look. (fixed, see comments --steve)
Future work
Now that we've untangled image exporting from editor state, we could expose some more helpful helpers for making this easier.
Fixes tld-2122
Change Type
minor
— New feature[^1]: publishes a
patch
release, for devDependencies useinternal
[^2]: will not publish a new versionTest Plan
Release Notes
TldrawImage
component.