Package org.joshy.sketch.model

Examples of org.joshy.sketch.model.SPath$PathSegment


        @Override
        public void execute() {
            if(context.getSelection().size() != 1) return;
            SNode node = context.getSelection().firstItem();
            if(!(node instanceof SPath)) return;
            SPath path = (SPath) node;
            Bounds bounds = path.getTransformedBounds();
            for(SPath.SubPath sub : path.getSubPaths()) {
                for(SPath.PathPoint pt : sub.getPoints()) {

                    pt.x = pt.x -bounds.getX()+path.getTranslateX();
                    pt.y = pt.y -bounds.getY()+path.getTranslateY();
                    pt.cx1 = pt.cx1 -bounds.getX()+path.getTranslateX();
                    pt.cy1 = pt.cy1 -bounds.getY()+path.getTranslateY();
                    pt.cx2 = pt.cx2 -bounds.getX()+path.getTranslateX();
                    pt.cy2 = pt.cy2 -bounds.getY()+path.getTranslateY();

                    modifyPoint(bounds,path,pt);

                    pt.x = pt.x + bounds.getX()-path.getTranslateX();
                    pt.y = pt.y + bounds.getY()-path.getTranslateY();
                    pt.cx1 = pt.cx1 + bounds.getX()-path.getTranslateX();
                    pt.cy1 = pt.cy1 + bounds.getY()-path.getTranslateY();
                    pt.cx2 = pt.cx2 + bounds.getX()-path.getTranslateX();
                    pt.cy2 = pt.cy2 + bounds.getY()-path.getTranslateY();
                }
            }
            path.recalcPath();
            context.redraw();
        }
View Full Code Here


            SNode first = context.getSelection().firstItem();
            if(! (first instanceof SShape)) return;
            SShape shape = (SShape) first;
            if(shape instanceof SPath) return;

            SPath path = shape.toPath();
            SketchDocument.SketchPage page = context.getDocument().getCurrentPage();
            page.remove(shape);
            page.add(path);
            context.redraw();
        }
View Full Code Here

    @Override
    protected void mousePressed(MouseEvent event, Point2D.Double cursor) {
        start = toolToModel(cursor);
        prev = toolToModel(cursor);
        if(node == null) {
            node = new SPath();
            currentPoint = new SPath.PathPoint(start.x,start.y);
            currentPoint.startPath = true;
            node.addPoint(currentPoint);
            context.getUndoManager().pushAction(new UndoableAddNodeAction(context,node,"path"));
            context.redraw();
View Full Code Here

TOP

Related Classes of org.joshy.sketch.model.SPath$PathSegment

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.