Properly calculate bounds of rotated elements
See original GitHub issueFrom: https://github.com/excalidraw/excalidraw/pull/1273#issuecomment-610385649
This is more like request for comment.
I’m not sure if it’s correct wording, but let’s call Coords
and Bounds
.
For unrotated diamonds:
For rotated diamonds:
Now, Coords is used for resizing and rotating, and Bounds is used for selection detection and calculating canvas size. Bounds are also currently used for multiple element resizing.
Issue 1: https://github.com/excalidraw/excalidraw/pull/1273#issuecomment-610345053 The selection doesn’t detect the diamond because it’s smaller than the Bounds.
Issue 2: When exporting, there is an extra margin compared to unrotated elements.
What would be an ideal solution and maybe a practical workaround?
(edit) We go with this https://github.com/excalidraw/excalidraw/issues/1303#issuecomment-610462010 and revisit the UI issue later.
Issue Analytics
- State:
- Created 3 years ago
- Comments:17 (17 by maintainers)
Top GitHub Comments
Anyway, you don’t need to convince me, I trust your judgement. As long as it fixes export and selection, it’s fine, and we can tweak it as we go along.
(Also, the selection issue I mentioned in the PR elsewhere isn’t really related to multiselection.)
(Yeah, I know.)
My original issue title was misleading. Basically we need to properly calculate bounds of rotated elements. (In code, improve
getElementBounds
.) What I would like to have discussed was the UI issue that may only happen with multiselection. I actually wondered if there could be any totally different solution.Now, I think the multiselection UI issue is trivial (just make the coords lighter, or we will come up with better ideas later). This issue is all about calculating bounds properly.
Could there be anybody here (or in the internet) who might be interested in tackling this???