From: Jussi Koskela Date: Thu, 10 Oct 2019 07:13:05 +0000 (+0300) Subject: Take the transform hint of DragItem into account during drag X-Git-Tag: v1.43.0~136^2~57 X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=5a370e0b751e60f36445716bef0cb2485c5fc7ef Take the transform hint of DragItem into account during drag gitlab #394 Change-Id: I2b0f18e663e9cc72145bb1a268bbc359293a46d5 --- diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/dnd/DragPainter.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/dnd/DragPainter.java index feb712cd3..3a7609b94 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/dnd/DragPainter.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/dnd/DragPainter.java @@ -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)) {