Package org.joshy.sketch.model

Examples of org.joshy.sketch.model.AbstractResizeableNode


    }

    @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();
    }
View Full Code Here

TOP

Related Classes of org.joshy.sketch.model.AbstractResizeableNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.