diff options
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org')
2 files changed, 14 insertions, 5 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/PortPositionLocator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/PortPositionLocator.java index 0a18f5b1487..45988d93fe7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/PortPositionLocator.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/PortPositionLocator.java @@ -136,7 +136,13 @@ public class PortPositionLocator implements IBorderItemLocator { ConnectionAnchor connectionAnchor = ((SVGNodePlateFigure) parentFigure).getConnectionAnchor(""); // Get the location point, with anchor. - ((SlidableRoundedRectangleAnchor) connectionAnchor).setOffset(getPortOffset()); + + // get the offset depending of the position of the port (inside, outside or onLine) + Dimension offset = getPortOffset().getCopy(); + parentFigure.translateToAbsolute(offset); + + ((SlidableRoundedRectangleAnchor) connectionAnchor).setOffset(offset); + Point locationForPort = ((SlidableRoundedRectangleAnchor) connectionAnchor).getLocation(parentRec.getCenter(), proposedLocation.getLocation()); ((SlidableRoundedRectangleAnchor) connectionAnchor).setOffset(new Dimension()); if (locationForPort != null) { @@ -222,8 +228,8 @@ public class PortPositionLocator implements IBorderItemLocator { portOffset.width = -figure.getBounds().width / 2; portOffset.height = -figure.getBounds().height / 2; } else if ("outside".equals(position)) { - portOffset.width = figure.getBounds().width / 2; - portOffset.height = figure.getBounds().height / 2; + portOffset.width = figure.getBounds().width / 2 - 1; + portOffset.height = figure.getBounds().height / 2 - 1; } // Else onLine: no offset is applied and the port is on the line. } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/RoundedRectangleLabelPositionLocator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/RoundedRectangleLabelPositionLocator.java index 5756ef7e19c..41b855c7dfc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/RoundedRectangleLabelPositionLocator.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/RoundedRectangleLabelPositionLocator.java @@ -552,8 +552,11 @@ public class RoundedRectangleLabelPositionLocator extends ExternalLabelPositionL // proposedBounds.setSize(target.getPreferredSize());//To block the Label // target.setBounds(proposedBounds);//To block the Label - super.relocate(target); - // target.setBounds(new Rectangle(getPreferredLocation(target), size)); + if (!getFloatingItemOffset().equals(new Dimension())) { + target.setBounds(new Rectangle(getPreferredLocation(target), size)); + } else { + super.relocate(target); + } } else { Rectangle rectSuggested = new Rectangle(getPreferredLocation(target), size); |