]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.g2d/src/org/simantics/g2d/dnd/DragPainter.java
Take the transform hint of DragItem into account during drag
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / dnd / DragPainter.java
index feb712cd31865f107166cb487cd798161e0b6e40..3a7609b947ece077c2fcee878b20cec5675a3d6f 100644 (file)
@@ -21,6 +21,7 @@ import org.simantics.g2d.canvas.impl.AbstractCanvasParticipant;
 import org.simantics.g2d.canvas.impl.SGNodeReflection.SGCleanup;
 import org.simantics.g2d.canvas.impl.SGNodeReflection.SGInit;
 import org.simantics.g2d.diagram.DiagramHints;
+import org.simantics.g2d.element.ElementHints;
 import org.simantics.g2d.participant.TransformUtil;
 import org.simantics.scenegraph.g2d.G2DParentNode;
 import org.simantics.scenegraph.g2d.IG2DNode;
@@ -188,6 +189,10 @@ public class DragPainter extends AbstractCanvasParticipant {
             Point2D pos = dropCtx.getItemPosition(item);
             if(pos != null) { // Position can (or at least seems to be) be null on the first frame
                 AffineTransform subt = AffineTransform.getTranslateInstance(pos.getX(), pos.getY());
+                AffineTransform at = item.getHintContext().getHint(ElementHints.KEY_TRANSFORM);
+                if (at != null) {
+                    subt.concatenate(at);
+                }
 
                 IG2DNode itemHolder = node.getNode(""+item.hashCode());
                 if (itemHolder != null && !(itemHolder instanceof SingleElementNode)) {