public class InfiniteCanvas
extends javafx.scene.layout.Region
InfiniteCanvas
provides a means to render a portion of a
hypothetically infinite canvas, on which arbitrary contents can be placed.
+----------------+ |content area | | | | +----------------+ | |visible area | | | | | +----------------+ | | +----------------+
The size of the InfiniteCanvas
itself determines the visible area,
i.e. it is reflected in its Node.layoutBoundsProperty()
. The content area
is determined by the (visible) bounds of the getContentGroup()
that
contains the content elements. These bounds can be accessed via the
contentBoundsProperty()
.
By default, scrollbars are shown when the content area exceeds the visible
area. They allow to navigate the scrollableBoundsProperty()
, which
resembles the union of the content area and the visible area. The horizontal
and vertical scroll offsets are controlled by the
horizontalScrollOffsetProperty()
and
verticalScrollOffsetProperty()
. The appearance of scrollbars can be
controlled with the following properties:
horizontalScrollBarPolicyProperty()
determines the
horizontal ScrollPane.ScrollBarPolicy
.
verticalScrollBarPolicyProperty()
determines the vertical
ScrollPane.ScrollBarPolicy
.
An arbitrary transformation can be applied to the contents that is controlled
by the contentTransformProperty()
. It is unrelated to scrolling,
i.e. translating the content does not change the scroll offset.
A background grid is rendered behind the contents per default. It always covers the complete visible area and can be enabled/disabled and customized via a set of properties:
showGridProperty()
determines whether or not to show the
background grid
zoomGridProperty()
determines whether or not to zoom the
background grid with the contents.
gridCellWidthProperty()
determines the grid cell width.
gridCellHeightProperty()
determines the grid cell height.
Internally, an InfiniteCanvas
consists of four layers:
+--------------------------------+ |scrollbar group | +--------------------------------+ |overlay group | +--------------------------------+ |scrolled pane (with sub-layers) | +--------------------------------+ |underlay group | +--------------------------------+
getUnderlayGroup()
is rendered at the bottom, it is neither
affected by the horizontalScrollOffsetProperty()
and
verticalScrollOffsetProperty()
nor by the
contentTransformProperty()
.
getScrolledPane()
is rendered above the
getUnderlayGroup()
and contains sub-layers. The
getScrolledPane()
and its sub-layers are affected by the
horizontalScrollOffsetProperty()
and
verticalScrollOffsetProperty()
.
getOverlayGroup()
is rendered above the
getScrolledPane()
. It is neither affected by the
horizontalScrollOffsetProperty()
and
verticalScrollOffsetProperty()
nor by the
contentTransformProperty()
.
getScrollBarGroup()
is rendered above the
getOverlayGroup()
. It contains the scrollbars.
getScrolledPane()
internally consists of the following four
sub-layers:
+--------------------------------+ |scrolled overlay group | +--------------------------------+ |content group | +--------------------------------+ |scrolled underlay group | +--------------------------------+ |grid canvas | +--------------------------------+
getGridCanvas()
is rendered at the bottom of the
getScrolledPane()
.
getScrolledUnderlayGroup()
is rendered above the
getGridCanvas()
.
getContentGroup()
is rendered above the
getScrolledUnderlayGroup()
. It is affected by the
contentTransformProperty()
.
getScrolledOverlayGroup()
is rendered above the
getContentGroup()
.
Type | Property and Description |
---|---|
javafx.beans.property.BooleanProperty |
clipContent
Returns the
BooleanProperty that determines if this
InfiniteCanvas does clipping, i.e. restricts its visibility to
its Node.layoutBoundsProperty() . |
javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Bounds> |
contentBounds
Provides the visual bounds of the content group in the local coordinate
system of this
InfiniteCanvas |
javafx.beans.property.ReadOnlyObjectProperty<javafx.scene.transform.Affine> |
contentTransform
Returns the viewport transform as a (read-only) property.
|
javafx.beans.property.DoubleProperty |
gridCellHeight
Returns the grid cell height as a (writable) property.
|
javafx.beans.property.DoubleProperty |
gridCellWidth
Returns the grid cell width as a (writable) property.
|
javafx.beans.property.ObjectProperty<javafx.scene.control.ScrollPane.ScrollBarPolicy> |
horizontalScrollBarPolicy
Returns the
ObjectProperty that controls the
ScrollPane.ScrollBarPolicy that decides when to show a horizontal scrollbar. |
javafx.beans.property.DoubleProperty |
horizontalScrollOffset
Returns the horizontal scroll offset as a property.
|
javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Bounds> |
scrollableBounds
Returns the bounds of the scrollable area in local coordinates of this
InfiniteCanvas . |
javafx.beans.property.BooleanProperty |
showGrid
Returns the
BooleanProperty that determines if a background grid
is shown within this InfiniteCanvas . |
javafx.beans.property.ObjectProperty<javafx.scene.control.ScrollPane.ScrollBarPolicy> |
verticalScrollBarPolicy
Returns the
ObjectProperty that controls the
ScrollPane.ScrollBarPolicy that decides when to show a vertical scrollbar. |
javafx.beans.property.DoubleProperty |
verticalScrollOffset
Returns the vertical scroll offset as a property.
|
javafx.beans.property.BooleanProperty |
zoomGrid
Returns the
BooleanProperty that determines if the background
grid is zoomed when the contents are zoomed. |
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, impl_showMnemonics, impl_treeVisible, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, visible
Modifier and Type | Class and Description |
---|---|
class |
InfiniteCanvas.GridCanvas
The
InfiniteCanvas.GridCanvas is a Canvas that draws grid points at
configurable steps. |
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_GRID_CELL_HEIGHT
The default grid cell height.
|
static double |
DEFAULT_GRID_CELL_WIDTH
The default grid cell width.
|
Constructor and Description |
---|
InfiniteCanvas()
Constructs a new
InfiniteCanvas . |
Modifier and Type | Method and 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 |
javafx.beans.property.ReadOnlyObjectProperty<javafx.scene.transform.Affine> |
contentTransformProperty()
Returns the viewport transform as a (read-only) property.
|
protected InfiniteCanvas.GridCanvas |
createGridCanvas()
Creates the
InfiniteCanvas.GridCanvas that is used to paint the background grid. |
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 InfiniteCanvas.GridCanvas |
getGridCanvas()
Returns the
InfiniteCanvas.GridCanvas that is used to paint the background grid. |
double |
getGridCellHeight()
Returns the value of the
gridCellHeightProperty() . |
double |
getGridCellWidth()
Returns the value of the
gridCellWidthProperty() . |
protected 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 ScrollBar s. |
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 . |
protected 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.DoubleProperty |
gridCellHeightProperty()
Returns the grid cell height as a (writable) property.
|
javafx.beans.property.DoubleProperty |
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.ScrollBarPolicy s
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. |
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 . |
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(double gridCellHeight)
Assigns the given value to the
gridCellHeightProperty() . |
void |
setGridCellWidth(double 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 |
unzoomGrid()
Disables zooming of the background grid.
|
protected void |
updateScrollBars()
Updates the
ScrollBar s' 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. |
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, impl_computeContains, impl_computeGeomBounds, impl_computeLayoutBounds, impl_createPeer, impl_notifyLayoutBoundsChanged, impl_pickNodeLocal, impl_updatePeer, 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, snapSize, snapSpace, snapToPixelProperty, widthProperty
getBaselineOffset, getChildren, getChildrenUnmodifiable, getImpl_traversalEngine, getManagedChildren, getStylesheets, impl_getAllParentStylesheets, impl_processCSS, impl_processMXNode, impl_traversalEngineProperty, isNeedsLayout, layout, layoutChildren, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setImpl_traversalEngine, setNeedsLayout, updateBounds
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, containsBounds, 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, 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, hasProperties, hoverProperty, idProperty, impl_clearDirty, impl_computeIntersects, impl_cssGetCursorInitialValue, impl_cssGetFocusTraversableInitialValue, impl_findStyles, impl_geomChanged, impl_getLeafTransform, impl_getMatchingStyles, impl_getPeer, impl_getPivotX, impl_getPivotY, impl_getPivotZ, impl_getStyleMap, impl_hasTransforms, impl_intersects, impl_intersectsBounds, impl_isDirty, impl_isDirtyEmpty, impl_isShowMnemonics, impl_isTreeVisible, impl_layoutBoundsChanged, impl_markDirty, impl_pickNode, impl_processCSS, impl_reapplyCSS, impl_setShowMnemonics, impl_setStyleMap, impl_showMnemonicsProperty, impl_syncPeer, impl_transformsChanged, impl_traverse, impl_treeVisibleProperty, 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, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visibleProperty
public javafx.beans.property.BooleanProperty clipContentProperty
BooleanProperty
that determines if this
InfiniteCanvas
does clipping, i.e. restricts its visibility to
its Node.layoutBoundsProperty()
.isClipContent()
,
setClipContent(boolean)
public javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Bounds> contentBoundsProperty
InfiniteCanvas
getContentBounds()
public javafx.beans.property.ReadOnlyObjectProperty<javafx.scene.transform.Affine> contentTransformProperty
getContentTransform()
,
setContentTransform(Affine)
public javafx.beans.property.DoubleProperty gridCellHeightProperty
getGridCellHeight()
,
setGridCellHeight(double)
public javafx.beans.property.DoubleProperty gridCellWidthProperty
getGridCellWidth()
,
setGridCellWidth(double)
public javafx.beans.property.ObjectProperty<javafx.scene.control.ScrollPane.ScrollBarPolicy> horizontalScrollBarPolicyProperty
ObjectProperty
that controls the
ScrollPane.ScrollBarPolicy
that decides when to show a horizontal scrollbar.getHorizontalScrollBarPolicy()
,
#setHorizontalScrollBarPolicy(ScrollBarPolicy)
public javafx.beans.property.DoubleProperty horizontalScrollOffsetProperty
public javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Bounds> scrollableBoundsProperty
InfiniteCanvas
. 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.getScrollableBounds()
public javafx.beans.property.BooleanProperty showGridProperty
BooleanProperty
that determines if a background grid
is shown within this InfiniteCanvas
.isShowGrid()
,
setShowGrid(boolean)
public javafx.beans.property.ObjectProperty<javafx.scene.control.ScrollPane.ScrollBarPolicy> verticalScrollBarPolicyProperty
ObjectProperty
that controls the
ScrollPane.ScrollBarPolicy
that decides when to show a vertical scrollbar.getVerticalScrollBarPolicy()
,
#setVerticalScrollBarPolicy(ScrollBarPolicy)
public javafx.beans.property.DoubleProperty verticalScrollOffsetProperty
public javafx.beans.property.BooleanProperty zoomGridProperty
BooleanProperty
that determines if the background
grid is zoomed when the contents are zoomed.isZoomGrid()
,
setZoomGrid(boolean)
public static final double DEFAULT_GRID_CELL_WIDTH
public static final double DEFAULT_GRID_CELL_HEIGHT
public InfiniteCanvas()
InfiniteCanvas
.protected void clipContent()
InfiniteCanvas
.public javafx.beans.property.BooleanProperty clipContentProperty()
BooleanProperty
that determines if this
InfiniteCanvas
does clipping, i.e. restricts its visibility to
its Node.layoutBoundsProperty()
.isClipContent()
,
setClipContent(boolean)
protected double[] computeContentBoundsInLocal()
[min-x, min-y, max-x, max-y]
surrounding
the content group
within the coordinate system
of this InfiniteCanvas
.[min-x, min-y, max-x, max-y]
surrounding
the content group
within the
coordinate system of this InfiniteCanvas
.protected double computeHv(double tx)
tx
- The horizontal translation distance.protected double[] computeScrollableBoundsInLocal()
InfiniteCanvas
.[minx, miny, maxx, maxy]
.protected double computeTx(double hv)
hv
- The horizontal scrollbar value.protected double computeTy(double vv)
vv
- The vertical scrollbar value.protected double computeVv(double ty)
ty
- The vertical translation distance.public javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Bounds> contentBoundsProperty()
InfiniteCanvas
getContentBounds()
public javafx.beans.property.ReadOnlyObjectProperty<javafx.scene.transform.Affine> contentTransformProperty()
getContentTransform()
,
setContentTransform(Affine)
protected InfiniteCanvas.GridCanvas createGridCanvas()
InfiniteCanvas.GridCanvas
that is used to paint the background grid.InfiniteCanvas.GridCanvas
that is used to paint the
background grid.protected java.util.List<? extends javafx.scene.Node> createLayers()
InfiniteCanvas
. Per default, the underlay group, the
scrolled pane, the overlay group, and the scrollbar group are returned in
that order.InfiniteCanvas
.protected javafx.scene.Group createScrollBarGroup()
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.Group
designated for holding the scrollbars.protected java.util.List<? extends javafx.scene.Node> createScrolledLayers()
InfiniteCanvas
. Per default, the grid canvas, the scrolled
underlay group, the content group, and the scrolled overlay group are
returned in that order.InfiniteCanvas
.public void fitToSize(double zoomMin, double zoomMax)
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(); }
zoomMin
- The minimum zoom level.zoomMax
- The maximum zoom level.java.lang.IllegalStateException
- when the content area is zero or the canvas area is zero.public javafx.geometry.Bounds getContentBounds()
contentBoundsProperty()
.contentBoundsProperty()
.public javafx.scene.Group getContentGroup()
Group
designated for holding the scrolled content.Group
designated for holding the scrolled content.public javafx.scene.transform.Affine getContentTransform()
content group
.content group
.protected InfiniteCanvas.GridCanvas getGridCanvas()
InfiniteCanvas.GridCanvas
that is used to paint the background grid.InfiniteCanvas.GridCanvas
that is used to paint the background grid.public double getGridCellHeight()
gridCellHeightProperty()
.gridCellHeightProperty()
.public double getGridCellWidth()
gridCellWidthProperty()
.gridCellWidthProperty()
.protected javafx.scene.control.ScrollBar getHorizontalScrollBar()
ScrollBar
, or null
if the
horizontal ScrollBar
was not yet created.ScrollBar
.public javafx.scene.control.ScrollPane.ScrollBarPolicy getHorizontalScrollBarPolicy()
ScrollPane.ScrollBarPolicy
that is currently used to decide when
to show a horizontal scrollbar.ScrollPane.ScrollBarPolicy
that is currently used to decide when
to show a horizontal scrollbar.public double getHorizontalScrollOffset()
public javafx.scene.Group getOverlayGroup()
Group
that is rendered above the contents but
below the scrollbars.Group
that is rendered above the contents but
below the scrollbars.public javafx.geometry.Bounds getScrollableBounds()
scrollableBoundsProperty()
.scrollableBoundsProperty()
.protected javafx.scene.Group getScrollBarGroup()
Group
designated for holding the ScrollBar
s.Group
designated for holding the ScrollBar
s.public javafx.scene.Group getScrolledOverlayGroup()
Group
.Group
.protected javafx.scene.layout.Pane getScrolledPane()
Pane
which is translated when scrolling. This
Pane
contains the getContentGroup()
, therefore, the
getContentTransform()
does not influence the scroll offset.Pane
that is translated when scrolling.public javafx.scene.Group getScrolledUnderlayGroup()
Group
.Group
.public javafx.scene.Group getUnderlayGroup()
Group
.Group
.protected javafx.scene.control.ScrollBar getVerticalScrollBar()
ScrollBar
, or null
if the
vertical ScrollBar
was not yet created.ScrollBar
.public javafx.scene.control.ScrollPane.ScrollBarPolicy getVerticalScrollBarPolicy()
ScrollPane.ScrollBarPolicy
that is currently used to decide when
to show a vertical scrollbar.ScrollPane.ScrollBarPolicy
that is currently used to decide when
to show a vertical scrollbar.public double getVerticalScrollOffset()
public javafx.beans.property.DoubleProperty gridCellHeightProperty()
getGridCellHeight()
,
setGridCellHeight(double)
public javafx.beans.property.DoubleProperty gridCellWidthProperty()
getGridCellWidth()
,
setGridCellWidth(double)
protected void hideGrid()
public javafx.beans.property.ObjectProperty<javafx.scene.control.ScrollPane.ScrollBarPolicy> horizontalScrollBarPolicyProperty()
ObjectProperty
that controls the
ScrollPane.ScrollBarPolicy
that decides when to show a horizontal scrollbar.getHorizontalScrollBarPolicy()
,
#setHorizontalScrollBarPolicy(ScrollBarPolicy)
public javafx.beans.property.DoubleProperty horizontalScrollOffsetProperty()
public boolean isClipContent()
clipContentProperty()
.clipContentProperty()
.public boolean isShowGrid()
showGridProperty()
.showGridProperty()
.public boolean isZoomGrid()
zoomGridProperty()
.zoomGridProperty()
.protected double lerp(double min, double max, double ratio)
[min;max]
.min
- The lower interval bound.max
- The upper interval bound.ratio
- A value in the interval [0;1]
.protected double norm(double min, double max, double value)
[min;max]
to range [0;1]
.min
- The lower bound of the range.max
- The upper bound of the range.value
- The value in the range.[0;1]
).protected void registerFadeInOutTransitions(javafx.scene.Node node)
Node
. The
transitions are used when the mouse enters/exits the node.node
- The Node
to which fade in/out transitions are added
upon mouse enter/exit.protected void registerUpdateScrollBarsOnBoundsChanges()
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()
horizontalScrollBarPolicyProperty()
and on the verticalScrollBarPolicyProperty()
that will call
updateScrollBars()
when one of the ScrollPane.ScrollBarPolicy
s
changes.protected void registerUpdateScrollBarsOnSizeChanges()
Region.widthProperty()
and on the
Region.heightProperty()
that will call updateScrollBars()
when
the size of this InfiniteCanvas
changes.public void reveal(javafx.scene.Node 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.
TODO: When the child node does not fit within the viewport bounds, it is not revealed.
child
- The child Node
to reveal.public javafx.beans.property.ReadOnlyObjectProperty<javafx.geometry.Bounds> scrollableBoundsProperty()
InfiniteCanvas
. 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.getScrollableBounds()
public void setClipContent(boolean clipContent)
clipContentProperty()
to the given value.clipContent
- The new value for the clipContentProperty()
.public void setContentTransform(javafx.scene.transform.Affine tx)
viewport transform
to the values specified by the given Affine
.tx
- The Affine
determining the new
viewport transform
.public void setGridCellHeight(double gridCellHeight)
gridCellHeightProperty()
.gridCellHeight
- The grid cell height that is assigned to the
gridCellHeightProperty()
.public void setGridCellWidth(double gridCellWidth)
gridCellWidthProperty()
.gridCellWidth
- The grid cell width that is assigned to the
gridCellWidthProperty()
.public void setHorizontalScrollBarPolicy(javafx.scene.control.ScrollPane.ScrollBarPolicy horizontalScrollBarPolicy)
horizontalScrollBarPolicyProperty()
to the
given ScrollPane.ScrollBarPolicy
.horizontalScrollBarPolicy
- The new ScrollPane.ScrollBarPolicy
for the horizontal scrollbar.public void setHorizontalScrollOffset(double scrollOffsetX)
scrollOffsetX
- The new horizontal scroll offset.public void setShowGrid(boolean showGrid)
showGridProperty()
.showGrid
- The new value that is assigned to the
showGridProperty()
.public void setVerticalScrollBarPolicy(javafx.scene.control.ScrollPane.ScrollBarPolicy verticalScrollBarPolicy)
verticalScrollBarPolicyProperty()
to the
given ScrollPane.ScrollBarPolicy
.verticalScrollBarPolicy
- The new ScrollPane.ScrollBarPolicy
for the vertical scrollbar.public void setVerticalScrollOffset(double scrollOffsetY)
scrollOffsetY
- The new vertical scroll offset.public void setZoomGrid(boolean zoomGrid)
showGridProperty()
.zoomGrid
- The new value that is assigned to the
showGridProperty()
.protected void showGrid()
public javafx.beans.property.BooleanProperty showGridProperty()
BooleanProperty
that determines if a background grid
is shown within this InfiniteCanvas
.isShowGrid()
,
setShowGrid(boolean)
protected void unclipContent()
InfiniteCanvas
.protected void unzoomGrid()
zoomGrid()
,
zoomGridProperty()
protected void updateScrollBars()
ScrollBar
s' visibilities, value ranges and value
increments based on the content
bounds
and the scrollable
bounds
. The update is not done if any of the ScrollBar
s is
currently in use.public javafx.beans.property.ObjectProperty<javafx.scene.control.ScrollPane.ScrollBarPolicy> verticalScrollBarPolicyProperty()
ObjectProperty
that controls the
ScrollPane.ScrollBarPolicy
that decides when to show a vertical scrollbar.getVerticalScrollBarPolicy()
,
#setVerticalScrollBarPolicy(ScrollBarPolicy)
public javafx.beans.property.DoubleProperty verticalScrollOffsetProperty()
protected void zoomGrid()
public javafx.beans.property.BooleanProperty zoomGridProperty()
BooleanProperty
that determines if the background
grid is zoomed when the contents are zoomed.isZoomGrid()
,
setZoomGrid(boolean)
Copyright (c) 2014 itemis AG and others. All rights reserved.