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()); IFigure f = getHostFigure(); Dimension min = f.getMinimumSize().getCopy(); Dimension max = f.getMaximumSize().getCopy(); IMapMode mmode = MapModeUtil.getMapMode(f); min.height = mmode.LPtoDP(min.height); min.width = mmode.LPtoDP(min.width); max.height = mmode.LPtoDP(max.height); max.width = mmode.LPtoDP(max.width); if (min.width > rect.width) rect.width = min.width; else if (max.width < rect.width) rect.width = max.width; if (min.height > rect.height) rect.height = min.height; else if (max.height < rect.height) rect.height = max.height; feedback.translateToRelative(rect); feedback.setBounds(rect); }
protected void showChangeBoundsFeedback(ChangeBoundsRequest request) { IFigure feedback = getDragSourceFeedbackFigure(); PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy()); getHostFigure().translateToAbsolute(rect); // Only enable horizontal dragging on lifelines(except lifelines that are result of a create // message). // https://bugs.eclipse.org/bugs/show_bug.cgi?id=364688 if (this.getHost() instanceof LifelineEditPart) { LifelineEditPart lifelineEP = (LifelineEditPart) this.getHost(); if (!SequenceUtil.isCreateMessageEndLifeline(lifelineEP)) { request.getMoveDelta().y = 0; } } rect.translate(request.getMoveDelta()); rect.resize(request.getSizeDelta()); IFigure f = getHostFigure(); Dimension min = f.getMinimumSize().getCopy(); Dimension max = f.getMaximumSize().getCopy(); IMapMode mmode = MapModeUtil.getMapMode(f); min.height = mmode.LPtoDP(min.height); min.width = mmode.LPtoDP(min.width); max.height = mmode.LPtoDP(max.height); max.width = mmode.LPtoDP(max.width); if (min.width > rect.width) rect.width = min.width; else if (max.width < rect.width) rect.width = max.width; if (min.height > rect.height) rect.height = min.height; else if (max.height < rect.height) rect.height = max.height; feedback.translateToRelative(rect); feedback.setBounds(rect); }