Skip to content

feat(examples): add options to export-canvas-as-image example#4534

Merged
steveruizok merged 8 commits intotldraw:mainfrom
nayounsang:export-example
Oct 3, 2024
Merged

feat(examples): add options to export-canvas-as-image example#4534
steveruizok merged 8 commits intotldraw:mainfrom
nayounsang:export-example

Conversation

@nayounsang
Copy link
Contributor

@nayounsang nayounsang commented Sep 17, 2024

I thought it would be nice to have an example that would allow users to experiment with the results depending on the option when exporting. Rather than creating a new example, I added a feature to an existing example because it was appropriate.

Change type

  • feature

Test plan

  1. Open the export-canvas-as-image example.
  2. Use the new control panel to adjust background, darkmode, padding, scale, and box arguments.
  3. Verify the exported image reflects the selected options.
  • Unit tests
  • End to end tests

Release notes

  • Added a new feature to the export-canvas-as-image example to allow configuring export options like background, dark mode, padding, scale, and crop box.

image
image

  • It is possible to open and close. It was placed so as not to affect the existing layout and drawing as much as possible.
  • It can set opts: background, darkmode, padding, scale and Box's arg(x,y,w,h).
    • Background and darkmode are checkbox.
    • Padding, scale, box's arg are number input.
  • Control component is implemented simply for DX.
  • ⚠️ I haven't implemented preserveAspectRatio yet. I will implement it if necessary.
  • ⚠️ If x, y, w, and h are only partially undefined in the box, no processing was performed. I thought it would be a good idea to check the results.

@huppy-bot huppy-bot bot added the feature New feature label Sep 17, 2024
@vercel
Copy link

vercel bot commented Sep 17, 2024

@nayounsang is attempting to deploy a commit to the tldraw Team on Vercel.

A member of the Team first needs to authorize it.

@nayounsang nayounsang changed the title Export example [Example] Setting opts in export-canvas-as-image Sep 17, 2024
@vercel
Copy link

vercel bot commented Oct 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
examples ✅ Ready (Inspect) Visit Preview Oct 3, 2024 8:03pm

@steveruizok
Copy link
Collaborator

Pushing some changes, then let's land this!

@steveruizok steveruizok added this pull request to the merge queue Oct 3, 2024
Merged via the queue into tldraw:main with commit 2f0bff1 Oct 3, 2024
@steveruizok steveruizok added the sdk Affects the tldraw sdk label Jan 2, 2026
@steveruizok steveruizok changed the title [Example] Setting opts in export-canvas-as-image feat(examples): add options to export-canvas-as-image example Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature sdk Affects the tldraw sdk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants