/** * Tells whether the current operation is a resize operation. The locked sizes will only be respected if * the operation is a resize operation. * @param root the item that is going to be updated * @return whether a resize operation is in progress */ protected boolean isResize( Root root ){ Rectangle current = root.getCurrentBounds(); Rectangle bounds = root.getBounds(); return !current.equals( bounds ); }
/** * Tells whether the current operation is a resize operation. The locked sizes will only be respected if * the operation is a resize operation. * @param root the item that is going to be updated * @return whether a resize operation is in progress */ protected boolean isResize( Root root ){ Rectangle current = root.getCurrentBounds(); Rectangle bounds = root.getBounds(); return !current.equals( bounds ); // || root.hasTreeChanged(); }
@Override public void updateBounds( Root root, double x, double y, double factorW, double factorH ) { Rectangle current = root.getCurrentBounds(); Rectangle bounds = root.getBounds(); boolean resize = isResize( root ); if( resize ){ resize = current.width > 10 && current.height > 10 && bounds.width > 10 && bounds.height > 10; } if( resize ){ updateBoundsLocked( root, x, y, factorW, factorH ); } else if( hasTreeChanged( root )){ updateBoundsLocked( root, x, y, factorW, factorH ); } else{ super.updateBounds( root, x, y, factorW, factorH ); } }
@Override public void updateBounds( Root root, double x, double y, double factorW, double factorH ) { Rectangle current = root.getCurrentBounds(); Rectangle bounds = root.getBounds(); boolean resize = isResize( root ); if( resize ){ resize = current.width > 10 && current.height > 10 && bounds.width > 10 && bounds.height > 10; } if( resize ){ try{ root.setBaseBounds( current ); super.updateBounds( root, x, y, factorW, factorH ); } finally{ root.setBaseBounds( null ); } updateBoundsLocked( root, x, y, factorW, factorH ); } else{ super.updateBounds( root, x, y, factorW, factorH ); } }