mask.relocate(bounds.getMinX() + diffMinX, bounds.getMinY() + diffMinY); break; default:
@Override public void relocate(Node node, double b0, double l0) { node.relocate(b0, l0); }
@Override public void relocate(Node node, double b0, double l0) { node.relocate(l0, b0); }
/** * * @param progress * @param animationLayoutInfo */ @Implements(interfaces=AnimationInterpolation.class) static public void animateFromTheOrigin(double progress, AnimationLayoutInfo animationLayoutInfo) { double lOX = animationLayoutInfo.originX - (animationLayoutInfo.layoutInfo.beadDiameter / 2); double lOY = animationLayoutInfo.originY - (animationLayoutInfo.layoutInfo.beadDiameter / 2); double lX = lOX + (progress * (animationLayoutInfo.nodeLayoutInfo.x - lOX)); double lY = lOY + (progress * (animationLayoutInfo.nodeLayoutInfo.y - lOY)); animationLayoutInfo.node.relocate(lX, lY); }
/** * * @param progress * @param animationLayoutInfo */ @Implements(interfaces=AnimationInterpolation.class) static public void animateAppear(double progress, AnimationLayoutInfo animationLayoutInfo) { animationLayoutInfo.node.setOpacity(progress); animationLayoutInfo.node.relocate(animationLayoutInfo.nodeLayoutInfo.x, animationLayoutInfo.nodeLayoutInfo.y); }
@Override protected void layoutChildren() { super.layoutChildren(); for(Node child : getChildren()) { if(!child.equals(playIcon) && !child.equals(pauseIcon)) { child.relocate(0, 0); child.resize(getWidth(), getHeight()); } } } }
/** * * @param progress * @param animationLayoutInfo */ @Implements(interfaces=AnimationInterpolation.class) static public void animateOverTheArc(double progress, AnimationLayoutInfo animationLayoutInfo) { double lAngle = animationLayoutInfo.layoutInfo.startAngle + (progress * (animationLayoutInfo.nodeLayoutInfo.angle - animationLayoutInfo.layoutInfo.startAngle)); double lX = calculateX(animationLayoutInfo.layoutInfo.chainDiameter, lAngle) + (animationLayoutInfo.layoutInfo.beadDiameter / 2) - (animationLayoutInfo.nodeLayoutInfo.w / 2) // add the difference between the bead's size and the node's, so it ends up in the center - animationLayoutInfo.layoutInfo.clipLeft ; double lY = calculateY(animationLayoutInfo.layoutInfo.chainDiameter, lAngle) + (animationLayoutInfo.layoutInfo.beadDiameter / 2) - (animationLayoutInfo.nodeLayoutInfo.w / 2) // add the difference between the bead's size and the node's, so it ends up in the center - animationLayoutInfo.layoutInfo.clipTop ; animationLayoutInfo.node.relocate(lX, lY); }
Node graphicsNode = collect.get(0); graphicsNode.autosize(); graphicsNode.relocate(0, 0); } else { double start = 0; for (Node n : collect) { n.autosize(); n.relocate(start, 0); start += n.prefWidth(-1); Node graphicsNode = collect.get(0); graphicsNode.autosize(); graphicsNode.relocate(getWidth()-graphicsNode.prefWidth(-1), 0); for (Node n : collect) { n.autosize(); n.relocate(getWidth()-n.prefWidth(-1) - start, 0); start += n.prefWidth(-1); Node graphicsNode = collect.get(0); graphicsNode.autosize(); graphicsNode.relocate(0, getHeight() - graphicsNode.prefHeight(-1)); } else { double start = 0; for (Node n : collect) { n.autosize(); n.relocate(start, getHeight() - n.prefHeight(-1)); start += n.prefWidth(-1);
@Override protected void layoutChildren() { getParent().requestLayout(); super.layoutChildren(); for (Node n : getManagedChildren()) { if (n instanceof Region) { Region p = (Region) n; double width = Math.max(p.getMinWidth(), p.getPrefWidth()); double height = Math.max(p.getMinHeight(), p.getPrefHeight()); n.resize(width, height); double nX = Math.min(0, n.getLayoutX()); double nY = Math.min(0, n.getLayoutY()); n.relocate(nX, nY); } } }
double deltaX = event.getSceneX() - mouseAnchor.get().getX(); double deltaY = event.getSceneY() - mouseAnchor.get().getY(); node.relocate(node.getLayoutX()+deltaX, node.getLayoutY()+deltaY); mouseAnchor.set(new Point2D(event.getSceneX(), event.getSceneY()));; });
EventHandler<MouseEvent> onMouseReleasedEventHandler = new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent t) { fixPosition((Node) t.getSource()); } }; resource.setOnMouseReleased(onMouseReleasedEventHandler); private void fixPosition( Node node) { double x = node.getTranslateX(); double y = node.getTranslateY(); node.relocate(node.getLayoutX() + x, node.getLayoutY() + y); node.setTranslateX(0); node.setTranslateY(0); }
node.relocate(x + 10, y - node.prefHeight(Integer.MAX_VALUE) / 2); node.autosize();
for (Data<X, Y> horizontalMarker : horizontalMarkers) { Line line = (Line) horizontalMarker.getNode(); line.setStartX(0); line.setEndX(getBoundsInLocal().getWidth()); line.setStartY(getYAxis().getDisplayPosition(horizontalMarker.getYValue()) + 0.5); // 0.5 for crispness line.setEndY(line.getStartY()); line.toFront(); Node text = nodeMap.get(line); text.relocate(line.getBoundsInParent().getMinX() + line.getBoundsInParent().getWidth()/2 - text.prefWidth(-1) / 2, line.getBoundsInParent().getMinY() - 30); }
node.setOnMouseDragged(mouseEvent -> node.relocate( mouseEvent.getScreenX() + dragDelta.x, mouseEvent.getScreenY() + dragDelta.y));
@Override protected void layoutChildren(double x, double y, double w, double h) { for (int i = 0; i < getChildren().size(); i++) { Node n = getChildren().get(i); double nw = snapSize(n.prefWidth(h)); double nh = snapSize(n.prefHeight(-1)); if (i > 0) { // We have to position the bread crumbs slightly overlapping double ins = n instanceof BreadCrumbButton ? ((BreadCrumbButton)n).getArrowWidth() : 0; x = snapPosition(x - ins); } n.resize(nw, nh); n.relocate(x, y); x += nw; } }
double deltaX = event.getSceneX() - mouseAnchor.get().getX(); double deltaY = event.getSceneY() - mouseAnchor.get().getY(); node.relocate(node.getLayoutX()+deltaX, node.getLayoutY()+deltaY); mouseAnchor.set(new Point2D(event.getSceneX(), event.getSceneY()));; });
node.relocate( mouseEvent.getScreenX() + dragDelta.x, mouseEvent.getScreenY() + dragDelta.y); circlePane.update();
if (graphic != null) { double centeredX = x + (w / 2) - graphic.getLayoutBounds().getWidth() / 2; graphic.relocate(centeredX, y); y += Math.max(graphic.getLayoutBounds().getHeight(), graphicFixedSize()); graphic.relocate(centeredX, y); if (graphic != null) { double centeredY = y + (h / 2) - graphic.getLayoutBounds().getHeight() / 2; graphic.relocate(x, centeredY);
@Override protected void layoutChildren(double x, double y, double w, double h) { // double currentWidth = getSkinnable().getWidth(); double cellWidth = getSkinnable().gridViewProperty().get().getCellWidth(); double cellHeight = getSkinnable().gridViewProperty().get().getCellHeight(); double horizontalCellSpacing = getSkinnable().gridViewProperty().get().getHorizontalCellSpacing(); double verticalCellSpacing = getSkinnable().gridViewProperty().get().getVerticalCellSpacing(); double xPos = 0; double yPos = 0; // This has been commented out as I removed the API from GridView until // a use case was created. // HPos currentHorizontalAlignment = getSkinnable().gridViewProperty().get().getHorizontalAlignment(); // if (currentHorizontalAlignment != null) { // if (currentHorizontalAlignment.equals(HPos.CENTER)) { // xPos = (currentWidth % computeCellWidth()) / 2; // } else if (currentHorizontalAlignment.equals(HPos.RIGHT)) { // xPos = currentWidth % computeCellWidth(); // } // } for (Node child : getChildren()) { child.relocate(xPos + horizontalCellSpacing, yPos + verticalCellSpacing); child.resize(cellWidth, cellHeight); xPos = xPos + horizontalCellSpacing + cellWidth + horizontalCellSpacing; } } }
mask.relocate(bounds.getMinX() + diffMinX, bounds.getMinY() + diffMinY); break; default: