}
@Override
public void changed() {
if(shape instanceof AbstractResizeableNode) {
AbstractResizeableNode res = (AbstractResizeableNode) shape;
Paint paint = shape.getFillPaint();
if(paint instanceof LinearGradientFill) {
LinearGradientFill lg = (LinearGradientFill) paint;
switch(lg.getStartXSnapped()) {
case Start: lg.setStartX(0); break;
case Middle: lg.setStartX(res.getBounds().getWidth() / 2); break;
case End: lg.setStartX(res.getBounds().getWidth()); break;
}
switch(lg.getStartYSnapped()) {
case Start: lg.setStartY(0); break;
case Middle: lg.setStartY(res.getBounds().getHeight() / 2); break;
case End: lg.setStartY(res.getBounds().getHeight()); break;
}
switch(lg.getEndXSnapped()) {
case Start: lg.setEndX(0); break;
case Middle: lg.setEndX(res.getBounds().getWidth()/2); break;
case End: lg.setEndX(res.getBounds().getWidth()); break;
}
switch(lg.getEndYSnapped()) {
case Start: lg.setEndY(0); break;
case Middle: lg.setEndY(res.getBounds().getHeight() / 2); break;
case End: lg.setEndY(res.getBounds().getHeight()); break;
}
}
}
super.changed();
}