protected void updateHoverHandles(@Nullable DrawingView view, @Nullable Figure f) { if (f != hoverFigure) { Rectangle r = null; if (hoverFigure != null && hoverFigure.isSelectable()) { for (Handle h : hoverHandles) { if (r == null) { r = h.getDrawingArea(); } else { r.add(h.getDrawingArea()); } h.setView(null); h.dispose(); } hoverHandles.clear(); } hoverFigure = f; if (hoverFigure != null) { hoverHandles.addAll(hoverFigure.createHandles(-1)); for (Handle h : hoverHandles) { h.setView(view); if (r == null) { r = h.getDrawingArea(); } else { r.add(h.getDrawingArea()); } } } if (r != null) { r.grow(1, 1); fireAreaInvalidated(r); } } }
/** * Overrides Step getBounds method. * * @param trackerPanel the tracker panel drawing the step * @return the bounding rectangle */ public Rectangle getBounds(TrackerPanel trackerPanel) { Rectangle bounds = getMark(trackerPanel).getBounds(false); Rectangle layoutRect = layoutBounds.get(trackerPanel); if (layoutRect != null) { bounds.add(layoutRect); } return bounds; }
public void drawingInvalidated(DrawingChangeEvent e) { Rectangle r = e.getInvalidatedRectangle(); if (getDamage() == null) { setDamage(r); } else { // don't manipulate rectangle returned by getDamage() directly // because it could be a cloned rectangle. Rectangle damagedR = getDamage(); damagedR.add(r); setDamage(damagedR); } }
/** * Compute the bounds of the <code>Lite</code> objets. * * @return The bounding rectangle. */ public Rectangle getBounds() { if (lites.isEmpty()) return new Rectangle(); Enumeration e = elements(); Lite l = (Lite) e.nextElement(); Rectangle r = l.getBounds(); while (e.hasMoreElements()) { l = (Lite) e.nextElement(); r.add(l.getBounds()); } return r; }
@Override public void mouseReleased(MouseEvent evt) { dragLocation = new Point(evt.getX(), evt.getY()); multicaster.trackEnd(anchor, dragLocation, evt.getModifiersEx(), getView()); // Note: we must not fire "Tool Done" in this method, because then we can not // listen to keyboard events for the handle. Rectangle r = new Rectangle(anchor.x, anchor.y, 0, 0); r.add(evt.getX(), evt.getY()); maybeFireBoundsInvalidated(r); dragLocation = null; }