Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2018-05-16 15:21:19 +0000
committerNicolas FAUVERGUE2018-05-22 15:58:01 +0000
commite43ff03026633edf446b02582a2f0f1dccd9cc0f (patch)
tree66f8147394fc100c42517763c4678d3d4fa2e703
parent42f3cf0568da9d6dcb5c15134a4e6591c648fec2 (diff)
downloadorg.eclipse.papyrus-e43ff03026633edf446b02582a2f0f1dccd9cc0f.tar.gz
org.eclipse.papyrus-e43ff03026633edf446b02582a2f0f1dccd9cc0f.tar.xz
org.eclipse.papyrus-e43ff03026633edf446b02582a2f0f1dccd9cc0f.zip
Bug 534767: [Sequence Diagram] Zoom is not taken into account when
resizing operands https://bugs.eclipse.org/bugs/show_bug.cgi?id=534767 - Translate size deltas from Request coordinates (Absolute mouse coordinates) to figure-relative coordinates, to take potential scale/zoom into account. Change-Id: I9a8b007ba491bce01e64f6ea1bf104364664df9c Signed-off-by: Camille Letavernier <cletavernier@eclipsesource.com>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentResizeEditPolicy.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandDragDropEditPolicy.java3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/tools/SeparatorResizeTracker.java9
4 files changed, 8 insertions, 11 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentResizeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentResizeEditPolicy.java
index 9e65bd3074b..7b60f062f58 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentResizeEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentResizeEditPolicy.java
@@ -246,7 +246,6 @@ public class CombinedFragmentResizeEditPolicy extends ResizableEditPolicyEx {
IFigure operandAboveFigure = getOperandAbove(request.getSeparatorIndex()).getFigure();
PrecisionRectangle location = new PrecisionRectangle(operandBelowFigure.getBounds());
- location.translate(0., request.getMoveDelta().preciseY());
Point newPosition = location.getTopLeft();
if (operandBelowFigure.containsPoint(newPosition) || operandAboveFigure.containsPoint(newPosition)) {
@@ -258,6 +257,7 @@ public class CombinedFragmentResizeEditPolicy extends ResizableEditPolicyEx {
operandBelowFigure.translateToAbsolute(location);
feedback.translateToRelative(location);
+ location.translate(0., request.getMoveDelta().preciseY());
feedback.setPoint(location.getTopLeft(), 0);
feedback.setPoint(location.getTopRight(), 1);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandDragDropEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandDragDropEditPolicy.java
index 27bf5540158..4b68a9243a2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandDragDropEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandDragDropEditPolicy.java
@@ -68,6 +68,9 @@ public class InteractionOperandDragDropEditPolicy extends ResizableEditPolicy {
IFigure figure = getHostFigure();
if (figure != null) {
Dimension currentDimension = figure.getBounds().getSize();
+
+ // Take zoom into account; the request contains absolute mouse coordinates delta.
+ figure.translateToRelative(delta);
Dimension newDimension = currentDimension.expand(delta);
if (newDimension.width() < MIN_WIDTH || newDimension.height < MIN_HEIGHT) {
// XXX Currently we just reject the request. Ideally, we'd simply edit
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java
index fb6d52f2dc0..06b48ed0b96 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java
@@ -94,7 +94,10 @@ public class ResizeOperandEditPolicy extends GraphicalEditPolicy {
View shapeView = NotationHelper.findView(operandPart);
Dimension size = operandPart.getFigure().getSize();
- size.expand(changeBoundsRequest.getSizeDelta().width, changeBoundsRequest.getSizeDelta().height);
+ // Take zoom into account; the request contains absolute mouse coordinates delta.
+ Dimension sizeDelta = changeBoundsRequest.getSizeDelta().getCopy();
+ operandPart.getFigure().translateToRelative(sizeDelta);
+ size.expand(sizeDelta.width, sizeDelta.height);
ICommand setBoundsCommand = new SetResizeCommand(editingDomain, "Resize Operands", new EObjectAdapter(shapeView), size);
compositeCommand.add(setBoundsCommand);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/tools/SeparatorResizeTracker.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/tools/SeparatorResizeTracker.java
index f64cb6e446a..bde2f808568 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/tools/SeparatorResizeTracker.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/tools/SeparatorResizeTracker.java
@@ -67,15 +67,6 @@ public class SeparatorResizeTracker extends ResizeTracker {
request.setLocation(location);
request.setEditParts(getOperationSet());
request.getExtendedData().clear();
-
- enforceConstraintsForResize(request);
- }
-
- /**
- * @param request
- */
- private void enforceConstraintsForResize(MoveSeparatorRequest request) {
- // TODO Make sure we don't go further than the Owner's bounds, or further than the previous/next separator
}
/**

Back to the top