diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SnapToAllDragEditPartsTracker.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SnapToAllDragEditPartsTracker.java index d29ae715f7..8256f6beae 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SnapToAllDragEditPartsTracker.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SnapToAllDragEditPartsTracker.java @@ -133,8 +133,7 @@ protected void snapPoint(ChangeBoundsRequest request) { } else { // Copied from // org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx.snapPoint(ChangeBoundsRequest) - // Adapted to force the snap in the expected initial direction but also to allow the snap in other - // perpendicular directions. + // Adapted to use precise coordinates for move delta (in case of zoom of 50% for example). Point moveDelta = request.getMoveDelta(); if (getState() == STATE_ACCESSIBLE_DRAG_IN_PROGRESS) { int restrictedDirection = 0; @@ -143,16 +142,12 @@ protected void snapPoint(ChangeBoundsRequest request) { restrictedDirection = restrictedDirection | PositionConstants.EAST; } else if (moveDelta.preciseX() < 0) { restrictedDirection = restrictedDirection | PositionConstants.WEST; - } else { - restrictedDirection = restrictedDirection | PositionConstants.EAST_WEST; } if (moveDelta.preciseY() > 0) { restrictedDirection = restrictedDirection | PositionConstants.SOUTH; } else if (moveDelta.preciseY() < 0) { restrictedDirection = restrictedDirection | PositionConstants.NORTH; - } else { - restrictedDirection = restrictedDirection | PositionConstants.NORTH_SOUTH; } request.getExtendedData().put(SnapToHelperUtil.RESTRICTED_DIRECTIONS, restrictedDirection); diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/MoveAllShapesWithArrowKeysTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/MoveAllShapesWithArrowKeysTest.java index 1350d89b35..ec4412c274 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/MoveAllShapesWithArrowKeysTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/MoveAllShapesWithArrowKeysTest.java @@ -118,7 +118,7 @@ protected void tearDown() throws Exception { * expected one (snap to the grid).
*/ public void testMoveContainer() { - moveInDirection("Container_p1", AbstractDiagramContainerEditPart.class, SWT.ARROW_RIGHT, false); + moveInDirection("Container_p1", AbstractDiagramContainerEditPart.class, SWT.ARROW_RIGHT, false, false, true); } /** @@ -128,7 +128,7 @@ public void testMoveContainer() { * one (snap to the grid).
*/ public void testMoveNode() { - moveInDirection("Node_p1", AbstractDiagramNodeEditPart.class, SWT.ARROW_DOWN, true); + moveInDirection("Node_p1", AbstractDiagramNodeEditPart.class, SWT.ARROW_DOWN, true, true, false); } /** @@ -140,7 +140,7 @@ public void testMoveNode() { * the expected one (snap to the brother).
*/ protected void testMoveNodeInContainer(ZoomLevel zoomLevel) { - moveInDirection("NC_C1", AbstractDiagramNodeEditPart.class, SWT.ARROW_RIGHT, true, false, false, zoomLevel); + moveInDirection("NC_C1", AbstractDiagramNodeEditPart.class, SWT.ARROW_RIGHT, true, false, true, zoomLevel); // Third move with snap to shape (as a brother is near) SWTBotGefEditPart elementToMove = editor.getEditPart("NC_C1", AbstractDiagramNodeEditPart.class);