/** * Get the source point. * @return . */ public Point2D getSource() { return source.getValue(); } /**
/** * Get the destination point. * @return . */ public Point2D getDestination() { return destination.getValue(); } /**
public void performDrag( Parent root, MouseEvent event) { rectangle.setVisible(true); final double parentScaleX = root. localToSceneTransformProperty().getValue().getMxx(); final double parentScaleY = root. localToSceneTransformProperty().getValue().getMyy(); final double translateX = -root. localToSceneTransformProperty().getValue().getTx(); final double translateY = -root. localToSceneTransformProperty().getValue().getTy(); secondX = event.getSceneX(); secondY = event.getSceneY(); firstX = Math.max(firstX, 0); firstY = Math.max(firstY, 0); secondX = Math.max(secondX, 0); secondY = Math.max(secondY, 0); double x = Math.min(firstX, secondX); double y = Math.min(firstY, secondY); double width = Math.abs(secondX - firstX); double height = Math.abs(secondY - firstY); rectangle.setX(x / parentScaleX + translateX / parentScaleX); rectangle.setY(y / parentScaleY + translateY / parentScaleY); rectangle.setWidth(width / parentScaleX); rectangle.setHeight(height / parentScaleY); selectIntersectingNodes(root, !event.isControlDown()); }
public void performDragBegin( Node n, MouseEvent event) { final double parentScaleX = n.getParent(). localToSceneTransformProperty().getValue().getMxx(); final double parentScaleY = n.getParent(). localToSceneTransformProperty().getValue().getMyy(); // record the current mouse X and Y position on Node mouseX = event.getSceneX(); mouseY = event.getSceneY(); if (centerNode) { Point2D p2d = n.getParent().sceneToLocal(mouseX, mouseY); nodeX = p2d.getX(); nodeY = p2d.getY(); } else { nodeX = n.getLayoutX() * parentScaleX; nodeY = n.getLayoutY() * parentScaleY; } n.toFront(); } }
public void performDrag( Node n, MouseEvent event) { final double parentScaleX = n.getParent(). localToSceneTransformProperty().getValue().getMxx(); final double parentScaleY = n.getParent(). localToSceneTransformProperty().getValue().getMyy(); // Get the exact moved X and Y double offsetX = event.getSceneX() - mouseX; double offsetY = event.getSceneY() - mouseY; nodeX += offsetX; nodeY += offsetY; double scaledX; double scaledY; if (centerNode) { Point2D p2d = n.getParent().sceneToLocal(mouseX, mouseY); scaledX = p2d.getX(); scaledY = p2d.getY(); } else { scaledX = nodeX * 1 / (parentScaleX); scaledY = nodeY * 1 / (parentScaleY); } n.setLayoutX(scaledX); n.setLayoutY(scaledY); // again set current Mouse x AND y position mouseX = event.getSceneX(); mouseY = event.getSceneY(); }
localToSceneTransformProperty().getValue().getMxx(); final double parentScaleY = n.getParent(). localToSceneTransformProperty().getValue().getMyy(); localToSceneTransformProperty().getValue().getMxx(); final double parentScaleY = n.getParent(). localToSceneTransformProperty().getValue().getMyy(); getValue().getMxx(); final double scaleY = n.localToSceneTransformProperty(). getValue().getMyy(); final double parentScaleX = n.getParent().localToSceneTransformProperty().getValue().getMxx(); final double parentScaleY = n.getParent().localToSceneTransformProperty().getValue().getMyy(); final double scaleX = n.localToSceneTransformProperty().getValue().getMxx(); final double scaleY = n.localToSceneTransformProperty().getValue().getMyy();
localToSceneTransformProperty().getValue().getMxx(); final double parentScaleY = n.getParent(). localToSceneTransformProperty().getValue().getMyy(); localToSceneTransformProperty().getValue().getMxx(); final double parentScaleY = n.getParent(). localToSceneTransformProperty().getValue().getMyy(); getValue().getMxx(); final double scaleY = n.localToSceneTransformProperty(). getValue().getMyy(); localToSceneTransformProperty().getValue().getMxx(); final double parentScaleY = n.getParent(). localToSceneTransformProperty().getValue().getMyy(); final double scaleX = n.localToSceneTransformProperty().getValue().getMxx(); final double scaleY = n.localToSceneTransformProperty().getValue().getMyy();
localToSceneTransformProperty().getValue().getMxx(); final double parentScaleY = n.getParent(). localToSceneTransformProperty().getValue().getMyy(); localToSceneTransformProperty().getValue().getMxx(); final double parentScaleY = n.getParent(). localToSceneTransformProperty().getValue().getMyy(); getValue().getMxx(); final double scaleY = n.localToSceneTransformProperty(). getValue().getMyy(); final double parentScaleX = n.getParent().localToSceneTransformProperty().getValue().getMxx(); final double parentScaleY = n.getParent().localToSceneTransformProperty().getValue().getMyy(); final double scaleX = n.localToSceneTransformProperty().getValue().getMxx(); final double scaleY = n.localToSceneTransformProperty().getValue().getMyy();
contentWidth = new SimpleDoubleProperty(this, "contentWidth", 0.0); DoubleBinding contentWidthBinding = control.contentMaxWidthProperty() .subtract(control.paddingLocalProperty().getValue().getLeft()) .subtract(control.paddingLocalProperty().getValue().getRight()) .subtract(2*DROP_SHADOW_PADDING); contentWidth.bind(contentWidthBinding); group.setLayoutX(control.paddingLocalProperty().getValue().getLeft());