Skip to content
Snippets Groups Projects
Commit 6fcf56cc authored by Florian Hölzl's avatar Florian Hölzl
Browse files

fixed ellipse border clamping

refs 352
parent 13695814
No related branches found
No related tags found
No related merge requests found
......@@ -101,25 +101,28 @@ public class EllipseCurveLayoutDiagramConfiguration extends
ChangeBoundsRequest request,
StickyConnectorEditPartBase<? extends ILayoutedModelElement> connectorEditPart,
IFigure connectorFigure) {
ILayoutedModelElement stickyConnector = connectorEditPart.getModel();
ILayoutedModelElement stickyConnectorModel = connectorEditPart.getModel();
double angle = getConnectorAngleAsDouble(stickyConnectorModel);
double angle = getConnectorAngleAsDouble(stickyConnector);
Dimension stateSize = connectorEditPart.getFigure().getSize();
Point oldPosition = calculateEllipseBorderPoint(angle, stateSize,
// compute old bounds
Dimension ellipseSize = connectorEditPart.getParentEditPart()
.getFigure().getSize();
Point oldPosition = calculateEllipseBorderPoint(angle, ellipseSize,
HALF_DEFAULT_CONNECTOR_SIZE).translate(
-HALF_DEFAULT_CONNECTOR_SIZE, -HALF_DEFAULT_CONNECTOR_SIZE);
// apply movement delta
Point newPosition = oldPosition.getTranslated(request.getMoveDelta());
Dimension ellipseSize = connectorEditPart.getParentEditPart()
.getFigure().getSize();
// fix new position to ellipse border
newPosition.translate(ellipseSize.getScaled(-.5));
newPosition.translate(HALF_DEFAULT_CONNECTOR_SIZE,
HALF_DEFAULT_CONNECTOR_SIZE);
// this converts from bounds to polar and back to ellipse border
// location
newPosition = calculateEllipseBorderPoint(new Polar(newPosition).angle,
ellipseSize, HALF_DEFAULT_CONNECTOR_SIZE).translate(
-HALF_DEFAULT_CONNECTOR_SIZE, -HALF_DEFAULT_CONNECTOR_SIZE);
// update move delta with new position
request.setMoveDelta(new Point().translate(newPosition
.getDifference(oldPosition)));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment