Open pshihn opened 4 years ago
Related to (and possibly blocked by) https://github.com/excalidraw/excalidraw/issues/294. Let's keep this open, but as for how to implement this, let's move there because it'll require more meta discussion.
What's about the idea to move also all elements that are completely inside the moving element. So any element will be moved when its surrounding element is moved.
That behaviour will not be limited to text inside box, but working for all element types.
I think this issue is nicely and more generically addressed by groups. @ReneCode give it a try (select multiple elements, cmd+option+g on mac).
@xixixao yes, you are right -looks better using group. Because on resize the text-element will be resized too.
May be thinking about an "automatic-grouping" approach would help to make the workflow smoother, like:
Grouping text to the shape when the text is created (via double click or text tool) while the shape is selected might work. It should still not autogroup if the shape is not selected and I'm adding text inside of it.
(then again any of this could be too much magic and stirring away from "just whiteboard" approach)
I've tried out to make auto-grouping when the new text is inside an element. try here
It works fine - if you leave the size of the element. But on resizing the element the text is resized too. That results a bad looking result when in a diagram with several elements with text the text size is different.
may be this approach is not ideal.
@ReneCode you need to double click the group and then only resize the rectangle (so I don't think this is a big problem).
I wonder how @vjeux likes this version.
Using grouping to solve this case came across my mind as well, but @ReneCode has a valid point. As an interim solution maybe?
I feel like it achieves the behavior we want: when you move the shape it moves the text around. Now there are some unfortunate side effects:
I feel like the downsides are greater than the wins. I feel like once the arrow linking is implemented, we can use the same link in order to move things around and it wouldn't have those drawbacks.
@vjeux Do you imagine we'll allow binding text to rectangles? I think this runs into a problem if we also want to allow binding of arrows to text, see bottom of my initial PR comment: #1899 .
Interesting. I didn't think you'd be able to bind arrows to text fwiw.
I like the way it is done in yED, when you drag some object
Text actually has a border which is just transparent. It will show up when you move the end-point of a line over the text border. Actually the line will be attached to text border when you release the mouse at this moment. So, why not just add a style to text border to show it? This will be quite convenient and useful.
Perhaps it could work just like when you make an arrow, that connects to a shape. As you get close, a drop zone appears, and if you drop there it is connected.
It can get a bit annoying when trying to move a block but it doesn't move the text inside it. Not a big issue, but I have forgotten to rubber-band (or command click) to move them together way too many times now :(
(I think there's a separate issue about linking arrows to shapes which is related)