@Override public synchronized void actionCompleted() { m_scaled.repaint(SVGObjectOutline.SELECTOR_OVERLAP); m_scaled.applyTextChanges(); m_scaled.commitChanges(); if (getScreenManager().getShowAllArea()) { getScreenManager().refresh(); } super.actionCompleted(); }
public ScaleAction(ComposerActionFactory factory, SVGObject selected, MouseEvent me) { super(factory); m_scaled = selected; m_x = me.getX(); m_y = me.getY(); pt = m_scaled.getOutline().getScalePivotPoint(m_x, m_y); m_scalePtIdx = getScalePivotPoint(m_scaled, m_x, m_y); }
private SVGObject.ScalePivotPoint getScalePivotPoint(SVGObject selObj, float x, float y) { SVGObjectOutline outline = selObj.getOutline(); if (outline.isAtScaleSEHandlePoint(x, y) || outline.isAtScaleEHandlePoint(x, y) || outline.isAtScaleSHandlePoint(x, y)) { return SVGObject.ScalePivotPoint.NW_CORNER; } else { return SVGObject.ScalePivotPoint.SE_CORNER; } }
@Override public boolean consumeEvent(AWTEvent evt, boolean isOutsideEvent) { if (!isOutsideEvent && evt.getID() == MouseEvent.MOUSE_DRAGGED) { MouseEvent me = (MouseEvent) evt; // calculate area to repaint Rectangle bBox = m_scaled.getScreenBBox(); m_scaled.scale(calculateScaleX(me.getX()), calculateScaleY(me.getY()), m_scalePtIdx); bBox.add(m_scaled.getScreenBBox()); m_factory .getSceneManager() .getScreenManager() .repaint(bBox, SVGObjectOutline.SELECTOR_OVERLAP); } else if (evt.getID() == MouseEvent.MOUSE_RELEASED) { actionCompleted(); m_scaled.commitChanges(); } return false; }
private boolean isSEScalePoint(SVGObject selObj, MouseEvent me) { return selObj.getOutline().isAtScaleSEHandlePoint((float) me.getX(), (float) me.getY()); }