Examples of GrabHandle


Examples of diva.canvas.interactor.GrabHandle

        // make events go to the grab-handle under the mouse
        Figure ef = _controller.getFigure(edge);
        _controller.getSelectionModel().addSelection(ef);

        ConnectorManipulator cm = (ConnectorManipulator) ef.getParent();
        GrabHandle gh = cm.getHeadHandle();
        layer.grabPointer(e, gh);
    }
View Full Code Here

Examples of diva.canvas.interactor.GrabHandle

                // Add it to the selection so it gets a manipulator, and
                // make events go to the grab-handle under the mouse
                getSelectionModel().addSelection(c);

                ConnectorManipulator cm = (ConnectorManipulator) c.getParent();
                GrabHandle gh = cm.getHeadHandle();
                layer.grabPointer(event, gh);
            } catch (Exception ex) {
                MessageHandler.error("Drag connection failed:", ex);
            }
        }
View Full Code Here

Examples of diva.canvas.interactor.GrabHandle

        public void translate(LayerEvent e, double x, double y) {
            // Snap to grid.
            double[] snapped = _snapConstraint.constrain(x, y);

            // Translate the grab-handle, resizing the geometry
            GrabHandle g = (GrabHandle) e.getFigureSource();
            g.translate(snapped[0], snapped[1]);

            // Transform the child.
            BoundsManipulator parent = (BoundsManipulator) g.getParent();
            BoundsGeometry geometry = parent.getGeometry();

            parent.getChild().transform(
                    CanvasUtilities.computeTransform(parent.getChild()
                            .getBounds(), geometry.getBounds()));
View Full Code Here

Examples of diva.canvas.interactor.GrabHandle

                // make events go to the grab-handle under the mouse
                Figure ef = getFigure(link);
                getSelectionModel().addSelection(ef);

                ConnectorManipulator cm = (ConnectorManipulator) ef.getParent();
                GrabHandle gh = cm.getHeadHandle();
                layer.grabPointer(event, gh);
            } catch (Exception ex) {
                MessageHandler.error("Drag connection failed:", ex);
            }
        }
View Full Code Here

Examples of diva.canvas.interactor.GrabHandle

            }
            Iterator i = geometry.sites();
            while (i.hasNext()) {
                // Create a grab handle and set up the interactor
                Site site = (Site) i.next();
                GrabHandle g = getGrabHandleFactory().createGrabHandle(site);
                g.setParent(this);
                g.setInteractor(getHandleInteractor());
                addGrabHandle(g);
            }

            // Move them where they should be - ?
            relocateGrabHandles();
View Full Code Here

Examples of diva.canvas.interactor.GrabHandle

        @Override
        public void translate(LayerEvent e, double dx, double dy) {

            AffineTransform af = new AffineTransform();

            GrabHandle grabHandle = (GrabHandle) e.getFigureSource();
            RectangleManipulator manipulator = (RectangleManipulator) grabHandle.getParent();
            RectangleGeometry geometry = manipulator.getGeometry();
            RotatableCanvasFigure roi = (RotatableCanvasFigure) manipulator.getChild();

            Point2D p = geometry.getRotateCenter();
            double cx = p.getX();
            double cy = p.getY();

            int id = grabHandle.getSite().getID();

            if (id == 0) {
                double x = e.getLayerX();
                double y = e.getLayerY();

                double x1 = x - dx - cx;
                double x2 = x - cx;
                double y1 = y - dy - cy;
                double y2 = y - cy;

                /////////////////////
                // Rotating Handle //
                /////////////////////
                double angle = Math.atan2(y2, x2) - Math.atan2(y1, x1);

                // Transform the child.
                af.setToRotation(angle, cx, cy);
                roi.transform(af);

            } else if (roi.isResizable()) {
                ///////////////////
                // Resize Handle //
                ///////////////////
                RectangularShape r1 = (RectangularShape) geometry.getRect().clone();

                // translating the grab handle
                grabHandle.translate(dx, dy);

                // transform the child roi
                RectangularShape r2 = geometry.getRect();
                double angle = geometry.getRotateAngle();
                af.concatenate(AffineTransform.getRotateInstance(angle, cx, cy));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.