/** * ************************************************************************* * Transitions * * * ************************************************************************ */ private Transition getShowAnimation(DialogTransition transitionType) { Transition animation = null; if (contentHolder != null) { switch (transitionType) { case LEFT: contentHolder.setTranslateX(-offsetX); animation = new LeftTransition(); break; case RIGHT: contentHolder.setTranslateX(offsetX); animation = new RightTransition(); break; case TOP: contentHolder.setTranslateY(-offsetY); animation = new TopTransition(); break; case BOTTOM: contentHolder.setTranslateY(offsetY); animation = new BottomTransition(); break; default: contentHolder.setScaleX(0); contentHolder.setScaleY(0); animation = new CenterTransition(); break; } } if (animation != null) animation.setOnFinished( (finish) -> onDialogOpenedProperty.get().handle(new JFXDialogEvent(JFXDialogEvent.OPENED))); return animation; }
private void resetProperties() { overlayPane.setVisible(false); contentHolder.setTranslateX(0); contentHolder.setTranslateY(0); contentHolder.setScaleX(1); contentHolder.setScaleY(1); }
/** Called when ever either min, max or value changes, so thumb's layoutX, Y is recomputed. */ void positionThumb() { ScrollBar s = getSkinnable(); double clampedValue = Utils.clamp(s.getMin(), s.getValue(), s.getMax()); trackPos = (s.getMax() - s.getMin() > 0) ? ((trackLength - thumbLength) * (clampedValue - s.getMin()) / (s.getMax() - s.getMin())) : (0.0F); if (!IS_TOUCH_SUPPORTED) { if (s.getOrientation() == Orientation.VERTICAL) { trackPos += decButton.prefHeight(-1); } else { trackPos += decButton.prefWidth(-1); } } thumb.setTranslateX( snapPosition( s.getOrientation() == Orientation.VERTICAL ? snappedLeftInset() : trackPos + snappedLeftInset())); thumb.setTranslateY( snapPosition( s.getOrientation() == Orientation.VERTICAL ? trackPos + snappedTopInset() : snappedTopInset())); }