tldraw / tldraw

SDK for creating whiteboards and canvas experiences on the web.
https://tldraw.dev
Other
33.04k stars 1.98k forks source link

[Bug]: Should tldraw check if duplicating / pasting will exceed the max shapes per page before going ahead with it? #3669

Closed kiastorm closed 2 weeks ago

kiastorm commented 2 weeks ago

What happened?

In my app, I have a fretboard shape which is made up of "sub"-shapes e.g each string, fret area, fret wire, the nut, each marker and each barre is an individual shape util.

Each fretboard created, by default, actually creates: 1 x fretboard (parent) shape 1 x nut shape 6 x string shapes 1 x fretboard label shape 1-24 x fret area shapes (default 4) 1-24 x fret wire shapes (default 4) 1-24 x fret label shapes (default 4)

meaning the average fretboard requires ~20 shapes. So the user can have ~100 fretboards per page, not including any markers, barres, annotations, frames etc.

So it can support around 3-4 chordsheets of 16 chords, but I was hoping to allow much much more

I noticed that if I try to duplicate the following shapes:

image

but duplicating them all would exceed the max shapes allowed per page, then it will duplicate as many as it can before throwing a "Max shapes limit reached" error.

I'm wondering if this is expected/wanted, as opposed to only going ahead with the duplicate op if the total page shapes would not exceed max shapes per page afterwards?

In my case - some shapes (strings, frets, etc.) cannot/should not exist without a parent fretboard, so they should not duplicate unless their parent fretboard can be duplicated also. Should be simple enough to work around, just thought I'd report in case this edge case was of interest

How can we reproduce the bug?

No response

What browsers are you seeing the problem on?

No response

Contact Details

No response

Code of Conduct

linear[bot] commented 2 weeks ago

TLD-2484 [Bug]: Should tldraw check if duplicating / pasting will exceed the max shapes per page before performing any operation?

MitjaBezensek commented 2 weeks ago

Yeah, we decided to make the suggested change. Similar to your example it could also cause issues for arrows where the shapes the arrows are bound to might not get duplicated, but the arrows might. Have a PR ready so I expect this to be release with the next version.