Package nodebox.graphics

Examples of nodebox.graphics.Point


    }

    @Override
    public boolean mouseDragged(Point pt) {
        if (dragState == DragState.NONE) return false;
        Point cp = (Point) getValue(translateName);
        double dx = pt.x - px;
        double dy = pt.y - py;
        if (dx == 0 && dy == 0) return false;
        startCombiningEdits("Set Value");
        if (dragState == DragState.CENTER) {
            silentSet(translateName, new Point(ox + dx, oy + dy));
        } else if (dragState == DragState.HORIZONTAL)
            silentSet(translateName, new Point(ox + dx, cp.y));
        else if (dragState == DragState.VERTICAL)
            silentSet(translateName, new Point(cp.x, oy + dy));
        return true;
    }
View Full Code Here


        if (hasInput("shape"))
            setVisible(isConnected("shape"));
    }

    public void draw(GraphicsContext ctx) {
        Point cp = (Point) getValue(positionName);
        if (cp == null) {
            return;
        }
        double cx = cp.x;
        double cy = cp.y;
View Full Code Here

    @Override
    public boolean mousePressed(Point pt) {
        px = pt.getX();
        py = pt.getY();

        Point op = (Point) getValue(positionName);
        ocx = op.x;
        ocy = op.y;
        owidth = (Double) getValue(widthName);
        oheight = (Double) getValue(heightName);
View Full Code Here

            case BOTTOM_RIGHT:
                silentSet(widthName, owidth + dx * 2);
                silentSet(heightName, oheight + dy * 2);
                break;
            case CENTER:
                silentSet(positionName, new Point(ocx + dx, ocy + dy));
        }
        return true;
    }
View Full Code Here

        Rect topRight = createHitRectangle(right, top);
        Rect bottomLeft = createHitRectangle(left, bottom);
        Rect bottomRight = createHitRectangle(right, bottom);
        px = pt.getX();
        py = pt.getY();
        Point op = (Point) getValue(scaleName);
        ox = op.x;
        oy = op.y;
        if (topLeft.contains(pt))
            dragState = DragState.TOP_LEFT;
        else if (topRight.contains(pt))
View Full Code Here

            handleWidth = HANDLE_WIDTH + dx * 2;
            handleHeight = HANDLE_HEIGHT + dy * 2;
        }
        double pctX = handleWidth / HANDLE_WIDTH;
        double pctY = handleHeight / HANDLE_HEIGHT;
        Point op = (Point) getValue(scaleName);
        if (scaleHorizontal)
            op = new Point(ox * pctX, op.y);
        else
            handleWidth = HANDLE_WIDTH;
        if (scaleVertical)
            op = new Point(op.x, oy * pctY);
        else
            handleHeight = HANDLE_HEIGHT;
        silentSet(scaleName, op);
        return true;
    }
View Full Code Here

    protected Rect createHitRectangle(double x, double y) {
        return new Rect(-1000, -1000, 2000, 2000);
    }

    public void draw(GraphicsContext ctx) {
        Point pos = (Point) getValue("position");
        double snapX = pos.x;
        double snapY = pos.y;
        double distance = (Double) getValue("distance");
        ctx.stroke(0.4, 0.4, 0.4, 0.5);
        ctx.strokewidth(1.0);
View Full Code Here

            return Math.abs(val / 2);
        return Math.abs(val);
    }

    public void draw(GraphicsContext ctx) {
        Point center = getCenter();
        double x = center.x;
        double y = center.y;
        double radius = getRadius();
        ctx.nofill();
        ctx.ellipsemode(GraphicsContext.EllipseMode.CENTER);
View Full Code Here

    @Override
    public boolean mousePressed(Point pt) {
        this.pt = null;
        double radius = getRadius();
        Point center = getCenter();
        float d = (float) Geometry.distance(center.x, center.y, pt.x, pt.y);
        dragging = (radius - 4 <= d && d <= radius + 4);
        return dragging;
    }
View Full Code Here

    }

    @Override
    public boolean mouseDragged(Point pt) {
        if (!dragging) return false;
        Point center = getCenter();
        float newSize = (float) Geometry.distance(center.x, center.y, pt.x, pt.y);
        if (mode == Mode.DIAMETER)
            newSize *= 2;
        if (newSize == getRadius()) return false;
        silentSet(radiusName, newSize);
View Full Code Here

TOP

Related Classes of nodebox.graphics.Point

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.