public void relocate(IFigure target) { final Point newEndPoint = _endPoint.getCopy(); target.translateToRelative(_endPoint); Rectangle startBounds = target.getBounds().getCopy(); animateBoundsChange(target, startBounds, newEndPoint); }
private Rectangle getInitialMenuBounds(final IFigure target) { Rectangle targetBounds = new PrecisionRectangle(_referenceFigure.getBounds().getResized(-1, -1)); _referenceFigure.translateToAbsolute(targetBounds); target.translateToRelative(targetBounds); return targetBounds; }
/** * @param relocateFigure * @return a modifiable Rectangle that represents the bounds of the figure to be relocated */ protected Rectangle getCurrentTargetBounds(IFigure relocateFigure) { IFigure reference = getReferenceFigure(); Rectangle targetBounds = new PrecisionRectangle(getReferenceBox().getResized(-1, -1)); reference.translateToAbsolute(targetBounds); relocateFigure.translateToRelative(targetBounds); return targetBounds; }
public static Rectangle getColumnBounds(GraphicalEditPart editPart, IFigure target) { Rectangle bounds = getAdjustedColumnBoundingRectangle(editPart); target.translateToRelative(bounds); Insets insets = target.getInsets(); bounds.translate(-insets.left, -insets.top); bounds.resize(insets.getWidth() + 1, insets.getHeight() + 1); return bounds; } }
/** * Relocates the target figure to the reference point with possible x and y * offsetting. Uses the target's preferredSize as the new size. */ public void relocate(IFigure target) { Point leftTop = new Point(_referencePoint.x+_xOffset, _referencePoint.y+_yOffset); //figure.translateToAbsolute(leftTop); target.translateToRelative(leftTop); Dimension d = target.getPreferredSize(); Rectangle rect = new Rectangle(leftTop, d); // to avoid enlargemeent if (_intersectFigure != null) { rect = rect.intersect(_intersectFigure.getBounds()); } target.setBounds(rect); }
((GraphicalEditPart)viewer.getRootEditPart()).getFigure().translateToRelative(location);
public void relocate(IFigure target) { Rectangle bounds; if (getReference() instanceof HandleBounds) { bounds = ((HandleBounds) getReference()).getHandleBounds(); } else { bounds = getReference().getBounds(); } Insets referenceInsets = getReference().getInsets(); Rectangle r = new Rectangle(bounds.x + referenceInsets.left, bounds.y + bounds.height, bounds.width - referenceInsets.getWidth(), TableEditConst.HEIGHT); getReference().translateToAbsolute(r); target.translateToRelative(r); target.setBounds(r); relocateChildren(target, getReference()); }
Point location = ((LocationRequest) request).getLocation() .getCopy(); part.getFigure().translateToRelative(location); return shouldUseObjectMode(location);
public void relocate(IFigure target) { Rectangle bounds; if (getReference() instanceof HandleBounds) { bounds = ((HandleBounds) getReference()).getHandleBounds(); } else { bounds = getReference().getBounds(); } // bounds = new PrecisionRectangle(bounds.getResized(-1, -1)); Insets referenceInsets = getReference().getInsets(); Rectangle r = new Rectangle(bounds.x + bounds.width, bounds.y + referenceInsets.top, TableEditConst.WIDTH, bounds.height - referenceInsets.getHeight()); bounds = new PrecisionRectangle(r); getReference().translateToAbsolute(bounds); target.translateToRelative(bounds); target.setBounds(bounds); relocateChildren(target, getReference()); }
/** * Shows or updates feedback for a change bounds request. * * @param request * the request */ protected void showChangeBoundsFeedback(ChangeBoundsRequest request) { IFigure feedback = getDragSourceFeedbackFigure(); PrecisionRectangle rect = new PrecisionRectangle( getInitialFeedbackBounds().getCopy()); getHostFigure().translateToAbsolute(rect); rect.translate(request.getMoveDelta()); rect.resize(request.getSizeDelta()); // to avoid enlarge feedback pane. // when draging a editpart inside designer to move/copy it, we do not // want to // enlarge the canvas, since that may resulting in relayout. rect = (PrecisionRectangle) rect.intersect(getFeedbackLayer() .getBounds()); feedback.translateToRelative(rect); feedback.setBounds(rect); }
parentFigure.translateToRelative(p); return horizontal ? p.x : p.y;