diff options
author | Géry Deloge | 2016-11-25 15:39:18 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2017-01-09 13:45:07 +0000 |
commit | 9274fbfb4f2f7b6d564089ff5a38767a246dd267 (patch) | |
tree | c3bc858fa9e0e03ac427d6828dd6c369b31c2538 | |
parent | d5a225d2092ed7c31fc5ba5a854b35a23db95f94 (diff) | |
download | org.eclipse.papyrus-9274fbfb4f2f7b6d564089ff5a38767a246dd267.tar.gz org.eclipse.papyrus-9274fbfb4f2f7b6d564089ff5a38767a246dd267.tar.xz org.eclipse.papyrus-9274fbfb4f2f7b6d564089ff5a38767a246dd267.zip |
Bug 490003: [Activity Diagram] Wrong pin label positioning on zoomed diagram
Change-Id: I164d448c904ada10fe8219bb98528273a21789bd
Signed-off-by: Géry Deloge <gery.deloge@cea.fr>
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java index 6505f7f2c24..2aa194989fc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java @@ -32,6 +32,7 @@ import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; +import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil; /** * This policy provides the selection handles, feedback and move command for @@ -47,29 +48,28 @@ public class ExternalLabelPrimaryDragRoleEditPolicy extends NonResizableLabelEdi mh.setBorder(null); return Collections.singletonList(mh); } - + + + /* + * generic getMove Command from + * org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy + * + */ @Override protected Command getMoveCommand(ChangeBoundsRequest request) { LabelEditPart editPart = (LabelEditPart) getHost(); - // FeedBack - Port + Delta - Rectangle updatedRect = new Rectangle(); + Rectangle updatedRect; PrecisionRectangle initialRect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy()); updatedRect = initialRect.getTranslated(getHostFigure().getParent().getBounds().getLocation().getNegated()); - updatedRect = updatedRect.getTranslated(request.getMoveDelta()); - // translate the feedback figure - PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy()); - getHostFigure().translateToAbsolute(rect); - rect.translate(request.getMoveDelta()); - rect.resize(request.getSizeDelta()); - getHostFigure().translateToRelative(rect); + // take into account the zoom + double zoomLevel = DiagramEditPartsUtil.getDiagramZoomLevel(editPart); + updatedRect = updatedRect.getTranslated(request.getMoveDelta().scale(1 / zoomLevel)); // translate according to the text alignments if (editPart instanceof PapyrusLabelEditPart) { switch (((PapyrusLabelEditPart) editPart).getTextAlignment()) { - case PositionConstants.LEFT: - break; case PositionConstants.CENTER: updatedRect.translate(getHostFigure().getBounds().width / 2, 0); break; @@ -80,7 +80,7 @@ public class ExternalLabelPrimaryDragRoleEditPolicy extends NonResizableLabelEdi break; } } - + ICommand moveCommand = new SetBoundsCommand(editPart.getEditingDomain(), DiagramUIMessages.MoveLabelCommand_Label_Location, new EObjectAdapter((View) editPart.getModel()), updatedRect); return new ICommandProxy(moveCommand); } |