Search in sources :

Example 1 with MouseExited

use of io.github.interacto.jfx.interaction.library.MouseExited in project latexdraw by arnobl.

the class CanvasController method configureBindings.

@Override
protected void configureBindings() {
    nodeBinder().usingInteraction(DnD::new).toProduce(MoveCamera::new).on(canvas).first(c -> {
        c.setScrollPane(canvas.getScrollPane());
        canvas.setCursor(Cursor.MOVE);
    }).then((i, c) -> {
        final ScrollPane pane = canvas.getScrollPane();
        c.setPx(pane.getHvalue() - (i.getTgtLocalPoint().getX() - i.getSrcLocalPoint().getX()) / canvas.getWidth());
        c.setPy(pane.getVvalue() - (i.getTgtLocalPoint().getY() - i.getSrcLocalPoint().getY()) / canvas.getHeight());
    }).when(i -> i.getButton() == MouseButton.MIDDLE).endOrCancel(i -> canvas.setCursor(Cursor.DEFAULT)).continuousExecution().bind();
    nodeBinder().toProduce(() -> new ChangeCursor(Cursor.HAND, canvas)).usingInteraction(MouseEntered::new).on(canvas.getSelectionBorder()).bind();
    nodeBinder().toProduce(() -> new ChangeCursor(Cursor.DEFAULT, canvas)).usingInteraction(MouseExited::new).on(canvas.getSelectionBorder()).bind();
}
Also used : Initializable(javafx.fxml.Initializable) MouseButton(javafx.scene.input.MouseButton) URL(java.net.URL) MagneticGrid(net.sf.latexdraw.view.jfx.MagneticGrid) Cursor(javafx.scene.Cursor) MoveCamera(io.github.interacto.jfx.command.MoveCamera) Inject(net.sf.latexdraw.util.Inject) ScrollPane(javafx.scene.control.ScrollPane) ResourceBundle(java.util.ResourceBundle) MouseExited(io.github.interacto.jfx.interaction.library.MouseExited) MouseEntered(io.github.interacto.jfx.interaction.library.MouseEntered) Canvas(net.sf.latexdraw.view.jfx.Canvas) ChangeCursor(io.github.interacto.jfx.command.ChangeCursor) DnD(io.github.interacto.jfx.interaction.library.DnD) MouseEntered(io.github.interacto.jfx.interaction.library.MouseEntered) ScrollPane(javafx.scene.control.ScrollPane) DnD(io.github.interacto.jfx.interaction.library.DnD) ChangeCursor(io.github.interacto.jfx.command.ChangeCursor) MouseExited(io.github.interacto.jfx.interaction.library.MouseExited)

Aggregations

ChangeCursor (io.github.interacto.jfx.command.ChangeCursor)1 MoveCamera (io.github.interacto.jfx.command.MoveCamera)1 DnD (io.github.interacto.jfx.interaction.library.DnD)1 MouseEntered (io.github.interacto.jfx.interaction.library.MouseEntered)1 MouseExited (io.github.interacto.jfx.interaction.library.MouseExited)1 URL (java.net.URL)1 ResourceBundle (java.util.ResourceBundle)1 Initializable (javafx.fxml.Initializable)1 Cursor (javafx.scene.Cursor)1 ScrollPane (javafx.scene.control.ScrollPane)1 MouseButton (javafx.scene.input.MouseButton)1 Inject (net.sf.latexdraw.util.Inject)1 Canvas (net.sf.latexdraw.view.jfx.Canvas)1 MagneticGrid (net.sf.latexdraw.view.jfx.MagneticGrid)1