/** {@inheritDoc} */ public PBounds getBoundsReference() { final PBounds targetBounds = target.getFullBounds(); camera.viewToLocal(targetBounds); camera.globalToLocal(targetBounds); final PBounds bounds = super.getBoundsReference(); bounds.setRect(targetBounds); return super.getBoundsReference(); }
/** * Force this handle to relocate itself using its locator. */ public void relocateHandle() { if (locator != null) { final PBounds b = getBoundsReference(); final Point2D aPoint = locator.locatePoint(null); if (locator instanceof PNodeLocator) { final PNode located = ((PNodeLocator) locator).getNode(); final PNode parent = getParent(); located.localToGlobal(aPoint); globalToLocal(aPoint); if (parent != located && parent instanceof PCamera) { ((PCamera) parent).viewToLocal(aPoint); } } final double newCenterX = aPoint.getX(); final double newCenterY = aPoint.getY(); if (newCenterX != b.getCenterX() || newCenterY != b.getCenterY()) { centerBoundsOnPoint(newCenterX, newCenterY); } } }
/** * Repaint from one of the camera's layers. The repaint region needs to be * transformed from view to local in this case. Unlike most repaint methods * in Piccolo2D this one must not modify the <code>viewBounds</code> * parameter. * * @since 1.3 * @param viewBounds bounds that require repainting, in view coordinates * @param repaintedLayer layer dispatching the repaint notification */ public void repaintFromLayer(final PBounds viewBounds, final PLayer repaintedLayer) { TEMP_REPAINT_RECT.setRect(viewBounds); viewToLocal(TEMP_REPAINT_RECT); if (getBoundsReference().intersects(TEMP_REPAINT_RECT)) { Rectangle2D.intersect(TEMP_REPAINT_RECT, getBoundsReference(), TEMP_REPAINT_RECT); repaintFrom(TEMP_REPAINT_RECT, repaintedLayer); } }