daybrush / moveable

Moveable! Draggable! Resizable! Scalable! Rotatable! Warpable! Pinchable! Groupable! Snappable!
https://daybrush.com/moveable/
MIT License
9.91k stars 612 forks source link

Bug: lost moveable control box reference #1023

Open SidIcarus opened 11 months ago

SidIcarus commented 11 months ago

Environments

Description

Release 0.46.0 seems to have introduced a bug where the the movable control box reference is lost when selecting/deselecting multiple targets. When using it to click on single targets it uses the same element but upon selecting/deselecting multiple, it creates a new element. In turn, this end ups creating a lot of one-time use elements and you must always call getControlBoxElement() to have the correct reference.

Use-case

using inputs to modify the moveable control box when multiple targets are selected

daybrush commented 11 months ago

@SidIcarus

Your observation is correct.

Moveable is

Single (+ No Select) Group Individual Group

All three cases have different elements. Using the same element would require a very large amount of work and would be difficult. I'm not sure if I can solve it, but I'll try.

SidIcarus commented 11 months ago

@daybrush

It is reasonable to have different elements for each use case; that is, seeing three would make sense. But we don't see three elements, we see a new element for each change. Prior to 0.46 it did not appear to do that.

I presume the routes that could be taken are

thoughts?

SidIcarus commented 11 months ago

I think I can just use the moveable.getManager().state/getState() for managing the control box size.

Removing the elements that are no longer used would be great though.

wen9218 commented 9 months ago

Hi, @daybrush, @SidIcarus I have the same issue with ngx-moveable v0.49.0. Whenever select multi-targets, moveable-control-box count is increased. So, ngx-moveable.moveable-control-box is not updated to top-left circle. It works good until ngx-moveable v0.42.0. I am going to obtain the top-left coordinate of the selected targets area. image

Can you please check and let me know a solution? Thank you

born2net commented 9 months ago

I am also seeing the same issue as @wen9218 please let us know if you need additional info and tx for a great lib!