i’ve read about the ways to move objects around.
i have to move a group, only clicking on the “move icon” inside it.
i’m working with the moveComponent().
the code on the icon’s mouseDragged event is:
system.gui.moveComponent(event.source.parent, event.x, event.y)
what happens is the group moves (even blinking while moved) in the middle position between the original position and the mouse position, that is not on the current mouse position.
note that this behaviour is not present if the script is put on a simple object, out of groups.
what can i do?
You’re going to have to add a couple of things. First your container is going to need to be anchored top-left. Second you’re going to change your script to look like the following:
point = system.gui.convertPointToScreen(event.x, event.y, event)
system.gui.moveComponent(event.source.parent, point, point)
You’ll notice that the group will jump down and to the left a little bit when you start to move it. That’s because it’s applying the move to the top left corner of the container. If you want it to not jump like that you’re going to have to keep track of the difference between where you actually clicked and where the top left corner of the container is and factor that in to your coordinates.
Hope this helps.