tldraw/assets/translations
Steve Ruiz 5bf05bbb3c
Flatten shapes to image(s) (#3933)
This PR adds some functionality for turning shapes into images.

![Kapture 2024-06-13 at 12 51
00](https://github.com/tldraw/tldraw/assets/23072548/78525e29-61b5-418f-889d-2f061f26f34d)

It adds:
- the `flattenShapesToImages`
- the `useFlatten` hook
- a `flatten-shapes-to-images` action (shift + f)
- adds `flattenImageBoundsExpand` option
- adds `flattenImageBoundsPadding` option

## Flatten shapes to images

The `flattenShapesToImages` helper method will 1) create an image for
the given shape ids, 2) add it to the canvas in the same location / size
as the source shapes, and then 3) delete the original shapes. The new
image will be placed correctly in the z index and in the correct
rotation of the root-most ancestor of the given shape ids.


![image](https://github.com/tldraw/tldraw/assets/23072548/fe888980-05a5-4369-863f-90c142f9f8b9)

It has an argument, `flattenImageBoundsExpand`, which if provided will
chunk the given shapes into images based on their overlapping (expanded)
bounding boxes.


![image](https://github.com/tldraw/tldraw/assets/23072548/c4799309-244d-4a2b-ac59-9c2fd100319c)

By default, the flatten action uses the editor's
`options.flattenImageBoundsExpand`. The `flattenImageBoundsPadding`
option is used as a value for how much larger the image should be than
the source image bounds (to account for large strokes, for example).

### Change Type

- [x] `sdk` — Changes the tldraw SDK
- [x] `feature` — New feature

### Test Plan

1. Select shapes
2. Select context menu > edit > flatten

- [ ] Unit Tests
- [ ] End to end tests

### Release Notes

- Add Flatten, a new menu item to flatten shapes into images
2024-06-16 11:40:50 +00:00
..
ar.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
ca.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
cs.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
da.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
de.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
en.json transfer-out: transfer out 2023-04-25 12:01:25 +01:00
es.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
fa.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
fi.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
fr.json Lokalise: Translations update (#3649) 2024-04-30 10:23:23 +00:00
gl.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
he.json Update community translations + remove unused translations (#1356) 2023-05-12 15:32:22 +00:00
hi-in.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
hr.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
hu.json Lokalise: Translations update (#3649) 2024-04-30 10:23:23 +00:00
id.json Lokalise: Translations update (#3649) 2024-04-30 10:23:23 +00:00
it.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
ja.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
ko-kr.json Lokalise: Translations update (#3649) 2024-04-30 10:23:23 +00:00
ku.json Update community translations + remove unused translations (#1356) 2023-05-12 15:32:22 +00:00
languages.json Lokalise: Translations update (#3649) 2024-04-30 10:23:23 +00:00
main.json Flatten shapes to image(s) (#3933) 2024-06-16 11:40:50 +00:00
my.json Update community translations + remove unused translations (#1356) 2023-05-12 15:32:22 +00:00
ne.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
no.json Update community translations + remove unused translations (#1356) 2023-05-12 15:32:22 +00:00
pl.json Update community translations + remove unused translations (#1356) 2023-05-12 15:32:22 +00:00
pt-br.json improves translation into pt-br (#2231) 2023-11-27 13:45:25 +00:00
pt-pt.json Update community translations + remove unused translations (#1356) 2023-05-12 15:32:22 +00:00
ro.json Update romanian translations (#3269) 2024-03-26 18:34:31 +00:00
ru.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
sl.json Camera options (#3282) 2024-05-04 17:39:04 +00:00
sv.json Update community translations + remove unused translations (#1356) 2023-05-12 15:32:22 +00:00
te.json Update community translations + remove unused translations (#1356) 2023-05-12 15:32:22 +00:00
th.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
tr.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
uk.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
vi.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
zh-cn.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00
zh-tw.json Lokalise: Translations update (#2908) 2024-02-22 11:20:51 +00:00