ComputeEffectiveCollection and moveParts

Hello

I have got yet another problem which I do not know how to handle.

As I mentioned in this topic: Overriding draggingTool.moveParts - #5 by walter
I am using “draggingTool.computEffectiveCollection” to gather all elements belonging to the group of the dragged elements and move them in unison. I do this by comparing the groupIds of those Elements.

This behaviour works just fine, but now I saw hat there is a certain bug which I do not know how to solve:
Moving a group of objects means there is only one object selected of this group, which then tries to snap to other objects. I used the approach you suggested: Snapping to other objects - #4 by Hochware

However, snapping works the following: The element displays the guidelines where it could snap to, but still stays at the position where the mouse is as long as the dragging is still in progress. Only after releasing the mouse button, the element changes position according to the guidelines. The result is that the dragged Element snaps to the suggested postion, but all other elements from this group do not.

It is okay that only the selected element snaps to other objects, but the other objects in the group need to move by the same distance too. I do not see where the moving functionality after releasing the mouse happens, knowing that would probably be enough help already.

Untitled

As you can see in the image: Group “A” is moved and the guideline appears. if the mouse is released, the circle in group “A” will move slightly upward (distance marked with “1”), but the rectangle in group “A” wont (distance marked with “2”). I need to extend the collection of objects which are handled after releasing the mouse, because it seems that this is not affected by “computeEffectiveCollection”.

Best regards

Martin

You will need to change the GuidedDraggingTool.doDropOnto method to iterate over the collection’s non-link Parts, rather than just work on the first Part.

Thanks for the hint, by changing all other elements by the same distance the selected object moved while snapping, I got the behaviour I needed!