Java 类javafx.scene.input.MouseDragEvent 实例源码

项目:grapheditor    文件:ConnectorDragManager.java   
/**
 * Removes any previously existing mouse-drag event handlers from the connector's root JavaFX node that were added
 * by this class.
 *
 * @param connector the {@link GConnector} whose old handlers should be removed
 */
private void removeOldMouseDragHandlers(final GConnector connector) {

    final Node root = skinLookup.lookupConnector(connector).getRoot();

    if (dragDetectedHandlers.get(connector) != null) {
        root.removeEventHandler(MouseEvent.DRAG_DETECTED, dragDetectedHandlers.get(connector));
    }

    if (mouseDraggedHandlers.get(connector) != null) {
        root.removeEventHandler(MouseEvent.MOUSE_DRAGGED, mouseDraggedHandlers.get(connector));
    }

    if (mouseDragEnteredHandlers.get(connector) != null) {
        root.removeEventHandler(MouseDragEvent.MOUSE_DRAG_ENTERED, mouseDragEnteredHandlers.get(connector));
    }

    if (mouseDragExitedHandlers.get(connector) != null) {
        root.removeEventHandler(MouseDragEvent.MOUSE_DRAG_EXITED, mouseDragExitedHandlers.get(connector));
    }

    if (mouseDragReleasedHandlers.get(connector) != null) {
        root.removeEventHandler(MouseDragEvent.MOUSE_DRAG_RELEASED, mouseDragReleasedHandlers.get(connector));
    }
}
项目:grapheditor    文件:ConnectorDragManager.java   
/**
 * Adds mouse-drag handlers to a particular connector.
 *
 * @param connector the {@link GConnector} to which mouse-drag handlers should be added
 */
private void addMouseDragHandlers(final GConnector connector) {

    final EventHandler<MouseEvent> newDragDetectedHandler = event -> handleDragDetected(event, connector);
    final EventHandler<MouseEvent> newMouseDraggedHandler = event -> handleMouseDragged(event, connector);
    final EventHandler<MouseDragEvent> newMouseDragEnteredHandler = event -> handleDragEntered(event, connector);
    final EventHandler<MouseDragEvent> newMouseDragExitedHandler = event -> handleDragExited(event, connector);
    final EventHandler<MouseDragEvent> newMouseDragReleasedHandler = event -> handleDragReleased(event, connector);

    final Node root = skinLookup.lookupConnector(connector).getRoot();

    root.addEventHandler(MouseEvent.DRAG_DETECTED, newDragDetectedHandler);
    root.addEventHandler(MouseEvent.MOUSE_DRAGGED, newMouseDraggedHandler);
    root.addEventHandler(MouseDragEvent.MOUSE_DRAG_ENTERED, newMouseDragEnteredHandler);
    root.addEventHandler(MouseDragEvent.MOUSE_DRAG_EXITED, newMouseDragExitedHandler);
    root.addEventHandler(MouseDragEvent.MOUSE_DRAG_RELEASED, newMouseDragReleasedHandler);
}
项目:minesim    文件:MouseHandlerTest.java   
/**
 * create a drag mouseEvent
 */
private MouseDragEvent genMouseDrag(double x, double y) {
    return new MouseDragEvent(
            MouseDragEvent.MOUSE_DRAG_ENTERED,
            x,
            y,
            x,
            y,
            MouseButton.PRIMARY,
            1,
            false,
            false,
            false,
            false,
            true, //left click down
            false,
            false,
            false,
            false,
            new PickResult(null, x, y),
            genMouseClick(MouseEvent.MOUSE_PRESSED, 0, 0) //drag from origin
    );
}
项目:graph-editor    文件:ConnectorDragManager.java   
/**
 * Removes any previously existing mouse-drag event handlers from the connector's root JavaFX node that were added
 * by this class.
 *
 * @param connector the {@link GConnector} whose old handlers should be removed
 */
private void removeOldMouseDragHandlers(final GConnector connector) {

    final Node root = skinLookup.lookupConnector(connector).getRoot();

    if (dragDetectedHandlers.get(connector) != null) {
        root.removeEventHandler(MouseEvent.DRAG_DETECTED, dragDetectedHandlers.get(connector));
    }

    if (mouseDraggedHandlers.get(connector) != null) {
        root.removeEventHandler(MouseEvent.MOUSE_DRAGGED, mouseDraggedHandlers.get(connector));
    }

    if (mouseDragEnteredHandlers.get(connector) != null) {
        root.removeEventHandler(MouseDragEvent.MOUSE_DRAG_ENTERED, mouseDragEnteredHandlers.get(connector));
    }

    if (mouseDragExitedHandlers.get(connector) != null) {
        root.removeEventHandler(MouseDragEvent.MOUSE_DRAG_EXITED, mouseDragExitedHandlers.get(connector));
    }

    if (mouseDragReleasedHandlers.get(connector) != null) {
        root.removeEventHandler(MouseDragEvent.MOUSE_DRAG_RELEASED, mouseDragReleasedHandlers.get(connector));
    }
}
项目:graph-editor    文件:ConnectorDragManager.java   
/**
 * Adds mouse-drag handlers to a particular connector.
 *
 * @param connector the {@link GConnector} to which mouse-drag handlers should be added
 */
private void addMouseDragHandlers(final GConnector connector) {

    final EventHandler<MouseEvent> newDragDetectedHandler = event -> handleDragDetected(event, connector);
    final EventHandler<MouseEvent> newMouseDraggedHandler = event -> handleMouseDragged(event, connector);
    final EventHandler<MouseDragEvent> newMouseDragEnteredHandler = event -> handleDragEntered(event, connector);
    final EventHandler<MouseDragEvent> newMouseDragExitedHandler = event -> handleDragExited(event, connector);
    final EventHandler<MouseDragEvent> newMouseDragReleasedHandler = event -> handleDragReleased(event, connector);

    final Node root = skinLookup.lookupConnector(connector).getRoot();

    root.addEventHandler(MouseEvent.DRAG_DETECTED, newDragDetectedHandler);
    root.addEventHandler(MouseEvent.MOUSE_DRAGGED, newMouseDraggedHandler);
    root.addEventHandler(MouseDragEvent.MOUSE_DRAG_ENTERED, newMouseDragEnteredHandler);
    root.addEventHandler(MouseDragEvent.MOUSE_DRAG_EXITED, newMouseDragExitedHandler);
    root.addEventHandler(MouseDragEvent.MOUSE_DRAG_RELEASED, newMouseDragReleasedHandler);
}
项目:fluidgrid    文件:DragAndDrop.java   
@Override
public void handleMouseDragEntered(MouseDragEvent event) {
    if(overDD != null) {
        overDD.getStyleClass().removeAll("drag-over");
    }
    overDD = ((Node)event.getSource());
    ((Node)event.getSource()).getStyleClass().add("drag-over");
}
项目:j.commons    文件:DragActionHandler.java   
@Override
public void register(Node node) {
    requireNonNull(node, "Parameter 'node' is null");

    node.addEventFilter(MouseEvent.MOUSE_DRAGGED, dragHandler);
    node.addEventFilter(MouseDragEvent.MOUSE_RELEASED, dragFinishedHandler);
}
项目:j.commons    文件:DragActionHandler.java   
@Override
public void unregister(Node node) {
    requireNonNull(node, "Parameter 'node' is null");

    node.removeEventFilter(MouseEvent.MOUSE_DRAGGED, dragHandler);
    node.removeEventFilter(MouseDragEvent.MOUSE_RELEASED, dragFinishedHandler);
}
项目:VRL-JFXVis    文件:Main.java   
/** Sets up the invisible mouse plane that is needed for the dragging of nodes on the scene using the mouse.
 * The index of the mouse plane should be the same as the index for enableNewFocusPoint.
 * @param index the index of the rectangle in a rectangle list that will be used for dragging that specific object
 * 
 */
private Rectangle setupMousePlane(int index) {

    mousePlaneList.get(index).setLayoutX(-800 / 2);
    mousePlaneList.get(index).setLayoutY(-800 / 2);
    mousePlaneList.get(index).setOpacity(0.7);
    mousePlaneList.get(index).setMouseTransparent(true);
    mousePlaneList.get(index).setDepthTest(DepthTest.DISABLE); // this makes the plane to be picked even if there are objects closer to the camera

    mousePlaneList.get(index).setOnMouseDragOver(new EventHandler<MouseDragEvent>() {
        @Override
        public void handle(MouseDragEvent me) {
            if (me.isSecondaryButtonDown() && me.isAltDown()) {
                //do nothing, we are rotating on the gizmo
            } else if (me.isSecondaryButtonDown()) {
                Point3D coords = me.getPickResult().getIntersectedPoint();
                mouseOldX = mousePosX;
                mouseOldY = mousePosY;
                mousePosX = coords.getX();
                mousePosY = coords.getY();

                double z = coords.getZ();

                coords = mousePlaneList.get(index).localToParent(new Point3D(mousePosX, mousePosY, z)); //mouseplane has the same parent as the real plane and objects like cube
                mousePosX = coords.getX();
                mousePosY = coords.getY();
                mouseDeltaX = (mousePosX - mouseOldX);
                mouseDeltaY = (mousePosY - mouseOldY);

            }
        }
    });
    return mousePlaneList.get(index);
}
项目:fluidgrid    文件:DragAndDrop.java   
@Override
public void handleMouseDragReleased(Node endRegion, MouseDragEvent event) {
    Region source = (Region) event.getGestureSource();
    Region target = (Region) endRegion;

    sourceDD = null;

    source.getStyleClass().removeAll("drag-launch");

    if(source.equals(target)) {
        if(preview != null) {
            preview.close();
        }
        return;
    }

    if(!event.isConsumed()) {
        event.consume();
    } else {
        return;
    }




    if(host.getObjects().indexOf(target) > host.getObjects().indexOf(source)) {

        host.getObjects().remove(source);
        host.getObjects().add(host.getObjects().indexOf(target)+1, source);
    } else {

        host.getObjects().remove(source);
        host.getObjects().add(host.getObjects().indexOf(target), source);
    }

    if(preview!=null) {
        preview.close();
        preview = null;
    }

    host.update();

    for(ActionCompletedListener acl : acls ){
        acl.update();
    }
}
项目:fluidgrid    文件:MultiObjectPane.java   
@Override
public void addHandleMouseDragExited(EventHandler<MouseDragEvent> event) {
    dragMouseExitedEvents.add(event);
}
项目:fluidgrid    文件:MultiObjectPane.java   
@Override
public void addHandleMouseDragEntered(EventHandler<MouseDragEvent> event) {
    dragMouseEnteredEvents.add(event);
}
项目:fluidgrid    文件:MultiObjectPane.java   
@Override
public void addHandleMouseDragReleased(EventHandler<MouseDragEvent> event) {
    mouseDragReleasedEvents.add(event);
}
项目:fluidgrid    文件:MultiObjectPane.java   
@Override
public void handleMouseDragExited(MouseDragEvent event) {
    for (EventHandler<MouseDragEvent> h : dragMouseExitedEvents) {
        h.handle(event);
    }
}
项目:fluidgrid    文件:MultiObjectPane.java   
@Override
public void handleMouseDragEntered(MouseDragEvent event) {
    for (EventHandler<MouseDragEvent> h : dragMouseEnteredEvents) {
        h.handle(event);
    }
}
项目:fluidgrid    文件:MultiObjectPane.java   
@Override
public void handleMouseDragReleased(Node endRegion, MouseDragEvent event) {
    for (EventHandler<MouseDragEvent> h : mouseDragReleasedEvents) {
        h.handle(event);
    }
}
项目:tokentool    文件:TokenTool_Controller.java   
@FXML
void compositeTokenPane_MouseDragExited(MouseDragEvent event) {
}
项目:fluidgrid    文件:Selection.java   
@Override
public void handleMouseDragExited(MouseDragEvent event) {

}
项目:fluidgrid    文件:Selection.java   
@Override
public void handleMouseDragEntered(MouseDragEvent event) {

}
项目:fluidgrid    文件:Selection.java   
@Override
public void handleMouseDragReleased(Node endRegion, MouseDragEvent event) {

}
项目:fluidgrid    文件:DragAndDrop.java   
@Override
public void handleMouseDragExited(MouseDragEvent event) {

}
项目:fluidgrid    文件:Extension.java   
void handleMouseDragExited(MouseDragEvent event);
项目:fluidgrid    文件:Extension.java   
void handleMouseDragEntered(MouseDragEvent event);
项目:fluidgrid    文件:Extension.java   
void handleMouseDragReleased(Node endRegion, MouseDragEvent event);
项目:fluidgrid    文件:MultiEventHandle.java   
void addHandleMouseDragExited(EventHandler<MouseDragEvent> event);
项目:fluidgrid    文件:MultiEventHandle.java   
void addHandleMouseDragEntered(EventHandler<MouseDragEvent> event);
项目:fluidgrid    文件:MultiEventHandle.java   
void addHandleMouseDragReleased(EventHandler<MouseDragEvent> event);