diff options
| author | Laurent Fasani | 2018-11-20 17:15:09 +0000 |
|---|---|---|
| committer | Laurent Fasani | 2018-11-23 09:00:37 +0000 |
| commit | 39dc07ca4bc8445709251119ab600ff3e0ef2cd3 (patch) | |
| tree | 4819f3951c962835f3ae51e1a35fd3378eec2c2a | |
| parent | 3610d671395fffcf9b86a19c4657f1489d9a3ff3 (diff) | |
| download | org.eclipse.sirius-39dc07ca4bc8445709251119ab600ff3e0ef2cd3.tar.gz org.eclipse.sirius-39dc07ca4bc8445709251119ab600ff3e0ef2cd3.tar.xz org.eclipse.sirius-39dc07ca4bc8445709251119ab600ff3e0ef2cd3.zip | |
[541412] Fix BorderedNode drag and drop on container
* When dropping a bordered node on the target shadowed container, the
shadow area is not considered as a part of its owning container.
* The new behavior is when dragging on the shadow area, there is no
feedback at all.
Bug: 541412
Change-Id: I99668d0a0eeccaa6e833faeec9fa48afa5cd6783
Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
| -rw-r--r-- | plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/SpecificBorderItemSelectionEditPolicy.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/SpecificBorderItemSelectionEditPolicy.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/SpecificBorderItemSelectionEditPolicy.java index f74dfeaa24..7a03595928 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/SpecificBorderItemSelectionEditPolicy.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/SpecificBorderItemSelectionEditPolicy.java @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (c) 2002, 2016 IBM Corporation and others. + * Copyright (c) 2002, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -275,9 +275,9 @@ public class SpecificBorderItemSelectionEditPolicy extends ResizableEditPolicyEx // Only necessary in the case of bordered node dropping if (isFeedbackForBorderedNodeDropping(request, targetAbstractGraphicalEditPart) && hostEditPart instanceof IGraphicalEditPart - && !new EditPartQuery((IGraphicalEditPart) hostEditPart).isInLayoutingMode()) { + && !new EditPartQuery((IGraphicalEditPart) hostEditPart).isInLayoutingMode() + && isMouseOnTargetFigure(targetAbstractGraphicalEditPart, shiftedLocation)) { activateProhibitedFeedbacks(targetAbstractGraphicalEditPart, request); - DBorderItemLocator borderItemLocator = new FeedbackDBorderItemLocator(targetFigure); if (getOrCreateBorderNodeCollapseManager().isCollapsed(borderItemEP)) { borderItemLocator.setBorderItemOffset(IBorderItemOffsets.COLLAPSE_FILTER_OFFSET); @@ -287,8 +287,7 @@ public class SpecificBorderItemSelectionEditPolicy extends ResizableEditPolicyEx // Verify if the dropping of bordered node is not an element // of the same level if (targetAbstractGraphicalEditPart.getParent() != getHost().getParent().getParent()) { - // Verify if the parent is the diagram. If it, - // calculates the position of the ghost relative to the + // Verify if the parent is the diagram. If it, calculates the position of the ghost relative to the // diagram, otherwise compared to the parent if (targetAbstractGraphicalEditPart.getParent() instanceof DiagramEditPart) { targetAbstractGraphicalEditPart.getFigure().translateToAbsolute(feedbackRectangle); @@ -326,7 +325,6 @@ public class SpecificBorderItemSelectionEditPolicy extends ResizableEditPolicyEx final IBorderItemLocator borderItemLocator = borderItemEP.getBorderItemLocator(); if (borderItemLocator != null) { - getHostFigure().translateToRelative(feedbackRectangle); Rectangle newRect = getOrCreateBorderNodeCollapseManager().expandCollapsedNodeBounds(borderItemEP, feedbackRectangle); if (newRect != null) { @@ -354,6 +352,17 @@ public class SpecificBorderItemSelectionEditPolicy extends ResizableEditPolicyEx } /** + * Check if the given point is located on the figure of the given editPart.</br> + * This method is based on getClientArea which ignore the shadow area on bottom and right of a container. + */ + private boolean isMouseOnTargetFigure(AbstractGraphicalEditPart editPart, Point point) { + IFigure figure = editPart.getFigure(); + Point copy = point.getCopy(); + figure.translateToRelative(copy); + return figure.getClientArea(new Rectangle()).contains(copy); + } + + /** * The feedback is stored only if the request corresponds to several * elements and that the current element is not the last. * |
