Search in sources :

Example 1 with Ortho

use of spacegraph.space2d.hud.Ortho in project narchy by automenta.

the class Windo method postpaint.

protected void postpaint(GL2 gl) {
    DragEdit p;
    if ((p = potentialDragMode) != null) {
        float W, H;
        gl.glPushMatrix();
        v2 mousePos;
        if (this instanceof ZoomOrtho.HUD) {
            W = w();
            H = h();
            mousePos = ((Ortho) root()).finger.posGlobal;
        } else {
            W = H = 0.5f;
            mousePos = ((Ortho) root()).finger.pos.clone();
        // mousePos.scaled(W, H);
        // mousePos.add(+W/2, +H/2); //???
        // gl.glTranslatef(-W/2, -H/2, 0); //???
        }
        float pmx = mousePos.x;
        float pmy = mousePos.y;
        float resizeBorder = Math.max(W, H) * this.resizeBorder;
        switch(p) {
            case RESIZE_N:
                colorDragIndicator(gl);
                Draw.quad2d(gl, pmx, pmy, W / 2, H - resizeBorder, W / 2 + resizeBorder / 2, H, W / 2 - resizeBorder / 2, H);
                break;
            case RESIZE_E:
                colorDragIndicator(gl);
                Draw.quad2d(gl, pmx, pmy, W - resizeBorder, H / 2, W, H / 2 + resizeBorder / 2, W, H / 2 - resizeBorder / 2);
                break;
            case RESIZE_NE:
                colorDragIndicator(gl);
                Draw.quad2d(gl, pmx, pmy, W, H - resizeBorder, W, H, W - resizeBorder, H);
                break;
            case RESIZE_SE:
                colorDragIndicator(gl);
                Draw.quad2d(gl, pmx, pmy, W, resizeBorder, W, 0, W - resizeBorder, 0);
                break;
            case RESIZE_SW:
                colorDragIndicator(gl);
                Draw.quad2d(gl, pmx, pmy, 0, resizeBorder, 0, 0, resizeBorder, 0);
                break;
        }
        gl.glPopMatrix();
    }
}
Also used : ZoomOrtho(spacegraph.space2d.hud.ZoomOrtho) Ortho(spacegraph.space2d.hud.Ortho) spacegraph.util.math.v2(spacegraph.util.math.v2)

Example 2 with Ortho

use of spacegraph.space2d.hud.Ortho in project narchy by automenta.

the class Wiring method drag.

@Override
protected boolean drag(Finger f) {
    if (path == null) {
        path = new Path2D(64);
        ((Ortho) (start.root())).addOverlay(pathVis = new SketchedPath(path));
    }
    path.add(f.pos, 64);
    updateEnd(f);
    return true;
}
Also used : Ortho(spacegraph.space2d.hud.Ortho) Path2D(spacegraph.util.Path2D) SketchedPath(spacegraph.space2d.widget.meta.SketchedPath)

Aggregations

Ortho (spacegraph.space2d.hud.Ortho)2 ZoomOrtho (spacegraph.space2d.hud.ZoomOrtho)1 SketchedPath (spacegraph.space2d.widget.meta.SketchedPath)1 Path2D (spacegraph.util.Path2D)1 spacegraph.util.math.v2 (spacegraph.util.math.v2)1