use of io.github.interacto.jfx.command.MoveCamera 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();
}
Aggregations