@Override public ResizeRequest getRequest( RequestDimension size, Leaf leaf ) { if( size != null ){ Rectangle modified = leaf.getCurrentBounds(); // +0.1: to work against a later integer conversion that might round down double deltaWidth = size.getWidth() + 0.001 - modified.width; double deltaHeight = size.getHeight() + 0.001 - modified.height; Root root = leaf.getRoot(); deltaWidth /= root.getWidthFactor(); deltaHeight /= root.getHeightFactor(); return new ResizeRequest( deltaWidth, deltaHeight, size.isWidthSet() ? 1 : -1, size.isHeightSet() ? 1 : -1 ); } return null; }
@Override public ResizeRequest getRequest( RequestDimension size, Leaf leaf ) { if( size != null ){ Rectangle modified = leaf.getCurrentBounds(); // +0.1: to work against a later integer conversion that might round down double deltaWidth = size.getWidth() + 0.001 - modified.width; double deltaHeight = size.getHeight() + 0.001 - modified.height; Root root = leaf.getRoot(); deltaWidth /= root.getWidthFactor(); deltaHeight /= root.getHeightFactor(); return new ResizeRequest( deltaWidth, deltaHeight, size.isWidthSet() ? 1 : -1, size.isHeightSet() ? 1 : -1 ); } return null; }
@Override public RequestDimension prepareResize( Leaf leaf ) { boolean lockedWidth = isLockedHorizontally( leaf.getDockable() ); boolean lockedHeight = isLockedVertically( leaf.getDockable() ); if( !lockedWidth && !lockedHeight ) return null; RequestDimension request = new RequestDimension(); Rectangle bounds = leaf.getCurrentBounds(); if( lockedWidth ){ double width = leaf.getWidth(); if( width > 0 ){ request.setWidth( bounds.width ); } } if( lockedHeight ){ double height = leaf.getHeight(); if( height > 0 ){ request.setHeight( bounds.height ); } } return request; }
@Override public RequestDimension prepareResize( Leaf leaf ) { boolean lockedWidth = isLockedHorizontally( leaf.getDockable() ); boolean lockedHeight = isLockedVertically( leaf.getDockable() ); if( !lockedWidth && !lockedHeight ) return null; RequestDimension request = new RequestDimension(); Rectangle bounds = leaf.getCurrentBounds(); if( lockedWidth ){ double width = leaf.getWidth(); if( width > 0 ){ request.setWidth( bounds.width ); } } if( lockedHeight ){ double height = leaf.getHeight(); if( height > 0 ){ request.setHeight( bounds.height ); } } return request; }