Class InfiniteCanvas

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_GRID_CELL_HEIGHT
      The default grid cell height.
      static int DEFAULT_GRID_CELL_WIDTH
      The default grid cell width.
      static javafx.scene.paint.Color DEFAULT_GRID_POINT_COLOR
      The default Color that is used to draw grid points.
      • Fields inherited from class javafx.scene.layout.Region

        USE_COMPUTED_SIZE, USE_PREF_SIZE
      • Fields inherited from class javafx.scene.Node

        BASELINE_OFFSET_SAME_AS_HEIGHT
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void clipContent()
      Enables content clipping for this InfiniteCanvas.
      javafx.beans.property.BooleanProperty clipContentProperty()
      Returns the BooleanProperty that determines if this InfiniteCanvas does clipping, i.e. restricts its visibility to its Node.layoutBoundsProperty().
      protected double[] computeContentBoundsInLocal()
      Computes the bounds [min-x, min-y, max-x, max-y] surrounding the content group within the coordinate system of this InfiniteCanvas.
      protected double computeHv​(double tx)
      Converts a horizontal translation distance into the corresponding horizontal scrollbar value.
      protected double[] computeScrollableBoundsInLocal()
      Computes and returns the bounds of the scrollable area within this InfiniteCanvas.
      protected double computeTx​(double hv)
      Converts a horizontal scrollbar value into the corresponding horizontal translation distance.
      protected double computeTy​(double vv)
      Converts a vertical scrollbar value into the corresponding vertical translation distance.
      protected double computeVv​(double ty)
      Converts a vertical translation distance into the corresponding vertical scrollbar value.
      javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Bounds> contentBoundsProperty()
      Provides the visual bounds of the content group in the local coordinate system of this InfiniteCanvas as a (read-only) property.
      javafx.beans.property.ReadOnlyObjectProperty<javafx.scene.transform.Affine> contentTransformProperty()
      Returns the viewport transform as a (read-only) property.
      protected javafx.scene.layout.Region createGrid()
      Creates the Region that renders the grid (when it is enabled).
      protected javafx.scene.image.Image createGridTile()
      Locate or create an Image that represents a single grid cell/tile.
      protected java.util.List<? extends javafx.scene.Node> createLayers()
      Returns a list containing the top level layers in the visualization of this InfiniteCanvas.
      protected javafx.scene.Group createScrollBarGroup()
      Creates the Group designated for holding the scrollbars and places the scrollbars in it.
      protected java.util.List<? extends javafx.scene.Node> createScrolledLayers()
      Returns a list containing the scrolled layers in the visualization of this InfiniteCanvas.
      void fitToSize​(double zoomMin, double zoomMax)
      Adjusts the horizontalScrollOffsetProperty(), the verticalScrollOffsetProperty(), and the contentTransformProperty(), so that the getContentGroup() is fully visible within the bounds of this InfiniteCanvas if possible.
      javafx.geometry.Bounds getContentBounds()
      Returns the value of the contentBoundsProperty().
      javafx.scene.Group getContentGroup()
      Returns the Group designated for holding the scrolled content.
      javafx.scene.transform.Affine getContentTransform()
      Returns the transformation that is applied to the content group.
      protected javafx.scene.layout.Region getGridCanvas()
      Returns the Region that is used to paint the background grid.
      double getGridCellHeight()
      Returns the value of the gridCellHeightProperty().
      double getGridCellWidth()
      Returns the value of the gridCellWidthProperty().
      javafx.scene.control.ScrollBar getHorizontalScrollBar()
      Returns the horizontal ScrollBar, or null if the horizontal ScrollBar was not yet created.
      javafx.scene.control.ScrollPane.ScrollBarPolicy getHorizontalScrollBarPolicy()
      Returns the ScrollPane.ScrollBarPolicy that is currently used to decide when to show a horizontal scrollbar.
      double getHorizontalScrollOffset()
      Returns the current horizontal scroll offset.
      javafx.scene.Group getOverlayGroup()
      Returns the overlay Group that is rendered above the contents but below the scrollbars.
      javafx.geometry.Bounds getScrollableBounds()
      Returns the value of the scrollableBoundsProperty().
      protected javafx.scene.Group getScrollBarGroup()
      Returns the Group designated for holding the ScrollBars.
      javafx.scene.Group getScrolledOverlayGroup()
      Returns the scrolled overlay Group.
      protected javafx.scene.layout.Pane getScrolledPane()
      Returns the Pane which is translated when scrolling.
      javafx.scene.Group getScrolledUnderlayGroup()
      Returns the scrolled underlay Group.
      javafx.scene.Group getUnderlayGroup()
      Returns the underlay Group.
      javafx.scene.control.ScrollBar getVerticalScrollBar()
      Returns the vertical ScrollBar, or null if the vertical ScrollBar was not yet created.
      javafx.scene.control.ScrollPane.ScrollBarPolicy getVerticalScrollBarPolicy()
      Returns the ScrollPane.ScrollBarPolicy that is currently used to decide when to show a vertical scrollbar.
      double getVerticalScrollOffset()
      Returns the current vertical scroll offset.
      javafx.beans.property.IntegerProperty gridCellHeightProperty()
      Returns the grid cell height as a (writable) property.
      javafx.beans.property.IntegerProperty gridCellWidthProperty()
      Returns the grid cell width as a (writable) property.
      protected void hideGrid()
      Disables the background grid.
      javafx.beans.property.ObjectProperty<javafx.scene.control.ScrollPane.ScrollBarPolicy> horizontalScrollBarPolicyProperty()
      Returns the ObjectProperty that controls the ScrollPane.ScrollBarPolicy that decides when to show a horizontal scrollbar.
      javafx.beans.property.DoubleProperty horizontalScrollOffsetProperty()
      Returns the horizontal scroll offset as a property.
      boolean isClipContent()
      Returns the value of the clipContentProperty().
      boolean isShowGrid()
      Returns the value of the showGridProperty().
      boolean isZoomGrid()
      Returns the value of the zoomGridProperty().
      protected double lerp​(double min, double max, double ratio)
      Linear interpolation between min and max at the given ratio.
      protected double norm​(double min, double max, double value)
      Normalizes a given value which is in range [min;max] to range [0;1].
      protected void registerFadeInOutTransitions​(javafx.scene.Node node)
      Registers fade in/out transitions for the given Node.
      protected void registerUpdateScrollBarsOnBoundsChanges()
      Registers listeners on the bounds-in-local property of the getScrolledPane() and on the bounds-in-parent property of the getContentGroup() that will call updateScrollBars() when one of the bounds is changed.
      protected void registerUpdateScrollBarsOnPolicyChanges()
      Registers listeners on the horizontalScrollBarPolicyProperty() and on the verticalScrollBarPolicyProperty() that will call updateScrollBars() when one of the ScrollPane.ScrollBarPolicys changes.
      protected void registerUpdateScrollBarsOnSizeChanges()
      Registers listeners on the Region.widthProperty() and on the Region.heightProperty() that will call updateScrollBars() when the size of this InfiniteCanvas changes.
      protected void repaintGrid()
      Repaints the tile image that depends on the grid cell size only.
      void reveal​(javafx.scene.Node child)
      Ensures that the specified child Node is visible to the user by scrolling to its position.
      javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Bounds> scrollableBoundsProperty()
      Returns the bounds of the scrollable area in local coordinates of this InfiniteCanvas as a (read-only) property.
      void setClipContent​(boolean clipContent)
      Sets the value of the clipContentProperty() to the given value.
      void setContentTransform​(javafx.scene.transform.Affine tx)
      Sets the transformation matrix of the viewport transform to the values specified by the given Affine.
      void setGridCellHeight​(int gridCellHeight)
      Assigns the given value to the gridCellHeightProperty().
      void setGridCellWidth​(int gridCellWidth)
      Assigns the given value to the gridCellWidthProperty().
      void setHorizontalScrollBarPolicy​(javafx.scene.control.ScrollPane.ScrollBarPolicy horizontalScrollBarPolicy)
      Sets the value of the horizontalScrollBarPolicyProperty() to the given ScrollPane.ScrollBarPolicy.
      void setHorizontalScrollOffset​(double scrollOffsetX)
      Sets the horizontal scroll offset to the given value.
      void setShowGrid​(boolean showGrid)
      Assigns the given value to the showGridProperty().
      void setVerticalScrollBarPolicy​(javafx.scene.control.ScrollPane.ScrollBarPolicy verticalScrollBarPolicy)
      Sets the value of the verticalScrollBarPolicyProperty() to the given ScrollPane.ScrollBarPolicy.
      void setVerticalScrollOffset​(double scrollOffsetY)
      Sets the vertical scroll offset to the given value.
      void setZoomGrid​(boolean zoomGrid)
      Assigns the given value to the showGridProperty().
      protected void showGrid()
      Enables the background grid.
      javafx.beans.property.BooleanProperty showGridProperty()
      Returns the BooleanProperty that determines if a background grid is shown within this InfiniteCanvas.
      protected void unclipContent()
      Disables content clipping for this InfiniteCanvas.
      protected void unregisterUpdateScrollBarsOnBoundsChanges()
      Unregisters the listeners that were previously registered within registerUpdateScrollBarsOnBoundsChanges().
      protected void unzoomGrid()
      Disables zooming of the background grid.
      protected void updateGridTransform​(javafx.scene.transform.Affine transform)
      This method is called when the grid transformation should be updated to match the given Affine.
      protected void updateScrollBars()
      Updates the ScrollBars' visibilities, value ranges and value increments based on the content bounds and the scrollable bounds.
      javafx.beans.property.ObjectProperty<javafx.scene.control.ScrollPane.ScrollBarPolicy> verticalScrollBarPolicyProperty()
      Returns the ObjectProperty that controls the ScrollPane.ScrollBarPolicy that decides when to show a vertical scrollbar.
      javafx.beans.property.DoubleProperty verticalScrollOffsetProperty()
      Returns the vertical scroll offset as a property.
      protected void zoomGrid()
      Enables zooming of the background grid when the contents are zoomed.
      javafx.beans.property.BooleanProperty zoomGridProperty()
      Returns the BooleanProperty that determines if the background grid is zoomed when the contents are zoomed.
      • Methods inherited from class javafx.scene.layout.Region

        backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getBackground, getBorder, getClassCssMetaData, getCssMetaData, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isResizable, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty
      • Methods inherited from class javafx.scene.Parent

        getBaselineOffset, getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, layoutChildren, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
      • Methods inherited from class javafx.scene.Node

        accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInitialFocusTraversable, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface javafx.css.Styleable

        getStyleableNode
    • Field Detail

      • DEFAULT_GRID_POINT_COLOR

        public static final javafx.scene.paint.Color DEFAULT_GRID_POINT_COLOR
        The default Color that is used to draw grid points.
      • DEFAULT_GRID_CELL_WIDTH

        public static final int DEFAULT_GRID_CELL_WIDTH
        The default grid cell width.
        See Also:
        Constant Field Values
      • DEFAULT_GRID_CELL_HEIGHT

        public static final int DEFAULT_GRID_CELL_HEIGHT
        The default grid cell height.
        See Also:
        Constant Field Values
    • Constructor Detail

      • InfiniteCanvas

        public InfiniteCanvas()
        Constructs a new InfiniteCanvas.
    • Method Detail

      • clipContent

        protected void clipContent()
        Enables content clipping for this InfiniteCanvas.
      • clipContentProperty

        public javafx.beans.property.BooleanProperty clipContentProperty()
        Returns the BooleanProperty that determines if this InfiniteCanvas does clipping, i.e. restricts its visibility to its Node.layoutBoundsProperty().
        Returns:
        The BooleanProperty that determines if this InfiniteCanvas does clipping.
      • computeContentBoundsInLocal

        protected double[] computeContentBoundsInLocal()
        Computes the bounds [min-x, min-y, max-x, max-y] surrounding the content group within the coordinate system of this InfiniteCanvas.
        Returns:
        The bounds [min-x, min-y, max-x, max-y] surrounding the content group within the coordinate system of this InfiniteCanvas.
      • computeHv

        protected double computeHv​(double tx)
        Converts a horizontal translation distance into the corresponding horizontal scrollbar value.
        Parameters:
        tx - The horizontal translation distance.
        Returns:
        The horizontal scrollbar value corresponding to the given translation.
      • computeScrollableBoundsInLocal

        protected double[] computeScrollableBoundsInLocal()
        Computes and returns the bounds of the scrollable area within this InfiniteCanvas.
        Returns:
        The bounds of the scrollable area, i.e. [minx, miny, maxx, maxy].
      • computeTx

        protected double computeTx​(double hv)
        Converts a horizontal scrollbar value into the corresponding horizontal translation distance.
        Parameters:
        hv - The horizontal scrollbar value.
        Returns:
        The horizontal translation distance corresponding to the given scrollbar value.
      • computeTy

        protected double computeTy​(double vv)
        Converts a vertical scrollbar value into the corresponding vertical translation distance.
        Parameters:
        vv - The vertical scrollbar value.
        Returns:
        The vertical translation distance corresponding to the given scrollbar value.
      • computeVv

        protected double computeVv​(double ty)
        Converts a vertical translation distance into the corresponding vertical scrollbar value.
        Parameters:
        ty - The vertical translation distance.
        Returns:
        The vertical scrollbar value corresponding to the given translation.
      • contentBoundsProperty

        public javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Bounds> contentBoundsProperty()
        Provides the visual bounds of the content group in the local coordinate system of this InfiniteCanvas as a (read-only) property.
        Returns:
        The bounds of the content group, i.e. minx, miny, maxx, maxy as ReadOnlyObjectProperty.
      • contentTransformProperty

        public javafx.beans.property.ReadOnlyObjectProperty<javafx.scene.transform.Affine> contentTransformProperty()
        Returns the viewport transform as a (read-only) property.
        Returns:
        The viewport transform as ReadOnlyObjectProperty.
      • createGrid

        protected javafx.scene.layout.Region createGrid()
        Creates the Region that renders the grid (when it is enabled).
        Returns:
        The newly created Region that renders the grid.
      • createGridTile

        protected javafx.scene.image.Image createGridTile()
        Locate or create an Image that represents a single grid cell/tile. The Image's dimensions is expected to match the grid cell size (width and height).
        Returns:
        An Image that represents a single grid cell/tile.
      • createLayers

        protected java.util.List<? extends javafx.scene.Node> createLayers()
        Returns a list containing the top level layers in the visualization of this InfiniteCanvas. Per default, the underlay group, the scrolled pane, the overlay group, and the scrollbar group are returned in that order.
        Returns:
        A list containing the top level layers in the visualization of this InfiniteCanvas.
      • createScrollBarGroup

        protected javafx.scene.Group createScrollBarGroup()
        Creates the Group designated for holding the scrollbars and places the scrollbars in it. Furthermore, event listeners are registered to update the scroll offset upon scrollbar movement.
        Returns:
        The Group designated for holding the scrollbars.
      • createScrolledLayers

        protected java.util.List<? extends javafx.scene.Node> createScrolledLayers()
        Returns a list containing the scrolled layers in the visualization of this InfiniteCanvas. Per default, the grid canvas, the scrolled underlay group, the content group, and the scrolled overlay group are returned in that order.
        Returns:
        A list containing the top level layers in the visualization of this InfiniteCanvas.
      • fitToSize

        public void fitToSize​(double zoomMin,
                              double zoomMax)
        Adjusts the horizontalScrollOffsetProperty(), the verticalScrollOffsetProperty(), and the contentTransformProperty(), so that the getContentGroup() is fully visible within the bounds of this InfiniteCanvas if possible. The content will be centered, but the given zoomMin and zoomMax values restrict the zoom factor, so that the content might exceed the canvas, or does not fill it completely.

        Note, that the contentTransformProperty() is set to a pure scale transformation by this method.

        Note, that fit-to-size cannot be performed in all situations. If the content area is 0 or the canvas area is 0, then this method cannot fit the content to the canvas size, and therefore, throws an IllegalStateException. The following condition can be used to test if fit-to-size can be performed:

         if (infiniteCanvas.getWidth() > 0 && infiniteCanvas.getHeight() > 0
                        && infiniteCanvas.getContentBounds().getWidth() > 0
                        && infiniteCanvas.getContentBounds().getHeight() > 0) {
                // save to call fit-to-size here
                infiniteCanvas.fitToSize();
         }
         
        Parameters:
        zoomMin - The minimum zoom level.
        zoomMax - The maximum zoom level.
        Throws:
        java.lang.IllegalStateException - when the content area is zero or the canvas area is zero.
      • getContentGroup

        public javafx.scene.Group getContentGroup()
        Returns the Group designated for holding the scrolled content.
        Returns:
        The Group designated for holding the scrolled content.
      • getContentTransform

        public javafx.scene.transform.Affine getContentTransform()
        Returns the transformation that is applied to the content group.
        Returns:
        The transformation that is applied to the content group.
      • getGridCanvas

        protected javafx.scene.layout.Region getGridCanvas()
        Returns the Region that is used to paint the background grid.
        Returns:
        The Region that is used to paint the background grid.
      • getHorizontalScrollBar

        public javafx.scene.control.ScrollBar getHorizontalScrollBar()
        Returns the horizontal ScrollBar, or null if the horizontal ScrollBar was not yet created.
        Returns:
        The horizontal ScrollBar.
      • getHorizontalScrollBarPolicy

        public javafx.scene.control.ScrollPane.ScrollBarPolicy getHorizontalScrollBarPolicy()
        Returns the ScrollPane.ScrollBarPolicy that is currently used to decide when to show a horizontal scrollbar.
        Returns:
        The ScrollPane.ScrollBarPolicy that is currently used to decide when to show a horizontal scrollbar.
      • getHorizontalScrollOffset

        public double getHorizontalScrollOffset()
        Returns the current horizontal scroll offset.
        Returns:
        The current horizontal scroll offset.
      • getOverlayGroup

        public javafx.scene.Group getOverlayGroup()
        Returns the overlay Group that is rendered above the contents but below the scrollbars.
        Returns:
        The overlay Group that is rendered above the contents but below the scrollbars.
      • getScrollBarGroup

        protected javafx.scene.Group getScrollBarGroup()
        Returns the Group designated for holding the ScrollBars.
        Returns:
        The Group designated for holding the ScrollBars.
      • getScrolledOverlayGroup

        public javafx.scene.Group getScrolledOverlayGroup()
        Returns the scrolled overlay Group.
        Returns:
        The scrolled overlay Group.
      • getScrolledPane

        protected javafx.scene.layout.Pane getScrolledPane()
        Returns the Pane which is translated when scrolling. This Pane contains the getContentGroup(), therefore, the getContentTransform() does not influence the scroll offset.
        Returns:
        The Pane that is translated when scrolling.
      • getScrolledUnderlayGroup

        public javafx.scene.Group getScrolledUnderlayGroup()
        Returns the scrolled underlay Group.
        Returns:
        The scrolled underlay Group.
      • getUnderlayGroup

        public javafx.scene.Group getUnderlayGroup()
        Returns the underlay Group.
        Returns:
        The underlay Group.
      • getVerticalScrollBar

        public javafx.scene.control.ScrollBar getVerticalScrollBar()
        Returns the vertical ScrollBar, or null if the vertical ScrollBar was not yet created.
        Returns:
        The vertical ScrollBar.
      • getVerticalScrollBarPolicy

        public javafx.scene.control.ScrollPane.ScrollBarPolicy getVerticalScrollBarPolicy()
        Returns the ScrollPane.ScrollBarPolicy that is currently used to decide when to show a vertical scrollbar.
        Returns:
        The ScrollPane.ScrollBarPolicy that is currently used to decide when to show a vertical scrollbar.
      • getVerticalScrollOffset

        public double getVerticalScrollOffset()
        Returns the current vertical scroll offset.
        Returns:
        The current vertical scroll offset.
      • gridCellHeightProperty

        public javafx.beans.property.IntegerProperty gridCellHeightProperty()
        Returns the grid cell height as a (writable) property.
        Returns:
        The grid cell height as a DoubleProperty.
      • gridCellWidthProperty

        public javafx.beans.property.IntegerProperty gridCellWidthProperty()
        Returns the grid cell width as a (writable) property.
        Returns:
        The grid cell width as a DoubleProperty.
      • hideGrid

        protected void hideGrid()
        Disables the background grid.
      • horizontalScrollBarPolicyProperty

        public javafx.beans.property.ObjectProperty<javafx.scene.control.ScrollPane.ScrollBarPolicy> horizontalScrollBarPolicyProperty()
        Returns the ObjectProperty that controls the ScrollPane.ScrollBarPolicy that decides when to show a horizontal scrollbar.
        Returns:
        The ObjectProperty that controls the ScrollPane.ScrollBarPolicy that decides when to show a horizontal scrollbar.
      • horizontalScrollOffsetProperty

        public javafx.beans.property.DoubleProperty horizontalScrollOffsetProperty()
        Returns the horizontal scroll offset as a property.
        Returns:
        A DoubleProperty representing the horizontal scroll offset.
      • lerp

        protected double lerp​(double min,
                              double max,
                              double ratio)
        Linear interpolation between min and max at the given ratio. Returns the interpolated value in the interval [min;max].
        Parameters:
        min - The lower interval bound.
        max - The upper interval bound.
        ratio - A value in the interval [0;1].
        Returns:
        The interpolated value.
      • norm

        protected double norm​(double min,
                              double max,
                              double value)
        Normalizes a given value which is in range [min;max] to range [0;1].
        Parameters:
        min - The lower bound of the range.
        max - The upper bound of the range.
        value - The value in the range.
        Returns:
        The normalized value (in range [0;1]).
      • registerFadeInOutTransitions

        protected void registerFadeInOutTransitions​(javafx.scene.Node node)
        Registers fade in/out transitions for the given Node. The transitions are used when the mouse enters/exits the node.
        Parameters:
        node - The Node to which fade in/out transitions are added upon mouse enter/exit.
      • registerUpdateScrollBarsOnBoundsChanges

        protected void registerUpdateScrollBarsOnBoundsChanges()
        Registers listeners on the bounds-in-local property of the getScrolledPane() and on the bounds-in-parent property of the getContentGroup() that will call updateScrollBars() when one of the bounds is changed.
      • registerUpdateScrollBarsOnSizeChanges

        protected void registerUpdateScrollBarsOnSizeChanges()
        Registers listeners on the Region.widthProperty() and on the Region.heightProperty() that will call updateScrollBars() when the size of this InfiniteCanvas changes.
      • repaintGrid

        protected void repaintGrid()
        Repaints the tile image that depends on the grid cell size only. The tile image is repeated when repainting the grid.
      • reveal

        public void reveal​(javafx.scene.Node child)
        Ensures that the specified child Node is visible to the user by scrolling to its position. The effect and style of the node are taken into consideration. After revealing a node, it will be fully visible if it fits within the current viewport bounds.

        When the child node's left side is left to the viewport, it will touch the left border of the viewport after revealing. When the child node's right side is right to the viewport, it will touch the right border of the viewport after revealing. When the child node's top side is above the viewport, it will touch the top border of the viewport after revealing. When the child node's bottom side is below the viewport, it will touch the bottom border of the viewport after revealing.

        The top and left sides have preference over the bottom and right sides, i.e. when the top side is aligned with the viewport, the bottom side will not be aligned, and when the left side is aligned with the viewport, the right side will not be aligned.

        Parameters:
        child - The child Node to reveal.
      • scrollableBoundsProperty

        public javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Bounds> scrollableBoundsProperty()
        Returns the bounds of the scrollable area in local coordinates of this InfiniteCanvas as a (read-only) property. The scrollable area corresponds to the visual bounds of the content group, which is expanded to cover at least the area of this InfiniteCanvas (i.e. the viewport) if necessary. It is thereby also the area that can be navigated via the scroll bars.
        Returns:
        The bounds of the scrollable area, i.e. minx, miny, maxx, maxy as ReadOnlyObjectProperty.
      • setContentTransform

        public void setContentTransform​(javafx.scene.transform.Affine tx)
        Sets the transformation matrix of the viewport transform to the values specified by the given Affine.
        Parameters:
        tx - The Affine determining the new viewport transform.
      • setHorizontalScrollBarPolicy

        public void setHorizontalScrollBarPolicy​(javafx.scene.control.ScrollPane.ScrollBarPolicy horizontalScrollBarPolicy)
        Sets the value of the horizontalScrollBarPolicyProperty() to the given ScrollPane.ScrollBarPolicy.
        Parameters:
        horizontalScrollBarPolicy - The new ScrollPane.ScrollBarPolicy for the horizontal scrollbar.
      • setHorizontalScrollOffset

        public void setHorizontalScrollOffset​(double scrollOffsetX)
        Sets the horizontal scroll offset to the given value.
        Parameters:
        scrollOffsetX - The new horizontal scroll offset.
      • setShowGrid

        public void setShowGrid​(boolean showGrid)
        Assigns the given value to the showGridProperty().
        Parameters:
        showGrid - The new value that is assigned to the showGridProperty().
      • setVerticalScrollBarPolicy

        public void setVerticalScrollBarPolicy​(javafx.scene.control.ScrollPane.ScrollBarPolicy verticalScrollBarPolicy)
        Sets the value of the verticalScrollBarPolicyProperty() to the given ScrollPane.ScrollBarPolicy.
        Parameters:
        verticalScrollBarPolicy - The new ScrollPane.ScrollBarPolicy for the vertical scrollbar.
      • setVerticalScrollOffset

        public void setVerticalScrollOffset​(double scrollOffsetY)
        Sets the vertical scroll offset to the given value.
        Parameters:
        scrollOffsetY - The new vertical scroll offset.
      • setZoomGrid

        public void setZoomGrid​(boolean zoomGrid)
        Assigns the given value to the showGridProperty().
        Parameters:
        zoomGrid - The new value that is assigned to the showGridProperty().
      • showGrid

        protected void showGrid()
        Enables the background grid.
      • showGridProperty

        public javafx.beans.property.BooleanProperty showGridProperty()
        Returns the BooleanProperty that determines if a background grid is shown within this InfiniteCanvas.
        Returns:
        The BooleanProperty that determines if a background grid is shown within this InfiniteCanvas.
      • unclipContent

        protected void unclipContent()
        Disables content clipping for this InfiniteCanvas.
      • unregisterUpdateScrollBarsOnBoundsChanges

        protected void unregisterUpdateScrollBarsOnBoundsChanges()
        Unregisters the listeners that were previously registered within registerUpdateScrollBarsOnBoundsChanges().
      • updateGridTransform

        protected void updateGridTransform​(javafx.scene.transform.Affine transform)
        This method is called when the grid transformation should be updated to match the given Affine. The grid transformation is
        Parameters:
        transform - The new transformation matrix for the grid canvas.
      • updateScrollBars

        protected void updateScrollBars()
        Updates the ScrollBars' visibilities, value ranges and value increments based on the content bounds and the scrollable bounds. The update is not done if any of the ScrollBars is currently in use.
      • verticalScrollBarPolicyProperty

        public javafx.beans.property.ObjectProperty<javafx.scene.control.ScrollPane.ScrollBarPolicy> verticalScrollBarPolicyProperty()
        Returns the ObjectProperty that controls the ScrollPane.ScrollBarPolicy that decides when to show a vertical scrollbar.
        Returns:
        The ObjectProperty that controls the ScrollPane.ScrollBarPolicy that decides when to show a vertical scrollbar.
      • verticalScrollOffsetProperty

        public javafx.beans.property.DoubleProperty verticalScrollOffsetProperty()
        Returns the vertical scroll offset as a property.
        Returns:
        A DoubleProperty representing the vertical scroll offset.
      • zoomGrid

        protected void zoomGrid()
        Enables zooming of the background grid when the contents are zoomed.
      • zoomGridProperty

        public javafx.beans.property.BooleanProperty zoomGridProperty()
        Returns the BooleanProperty that determines if the background grid is zoomed when the contents are zoomed.
        Returns:
        The BooleanProperty that determines if the background grid is zoomed when the contents are zoomed.