public class InfiniteCanvas extends 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 |
---|---|
BooleanProperty |
clipContent
Returns the
BooleanProperty that determines if this
InfiniteCanvas does clipping, i.e. restricts its visibility to
its Node.layoutBoundsProperty() . |
ReadOnlyObjectProperty<Bounds> |
contentBounds
Provides the visual bounds of the content group in the local coordinate
system of this
InfiniteCanvas as a (read-only) property. |
ReadOnlyObjectProperty<Affine> |
contentTransform
Returns the viewport transform as a (read-only) property.
|
IntegerProperty |
gridCellHeight
Returns the grid cell height as a (writable) property.
|
IntegerProperty |
gridCellWidth
Returns the grid cell width as a (writable) property.
|
ObjectProperty<ScrollPane.ScrollBarPolicy> |
horizontalScrollBarPolicy
Returns the
ObjectProperty that controls the
ScrollPane.ScrollBarPolicy that decides when to show a horizontal scrollbar. |
DoubleProperty |
horizontalScrollOffset
Returns the horizontal scroll offset as a property.
|
ReadOnlyObjectProperty<Bounds> |
scrollableBounds
Returns the bounds of the scrollable area in local coordinates of this
InfiniteCanvas as a (read-only) property. |
BooleanProperty |
showGrid
Returns the
BooleanProperty that determines if a background grid
is shown within this InfiniteCanvas . |
ObjectProperty<ScrollPane.ScrollBarPolicy> |
verticalScrollBarPolicy
Returns the
ObjectProperty that controls the
ScrollPane.ScrollBarPolicy that decides when to show a vertical scrollbar. |
DoubleProperty |
verticalScrollOffset
Returns the vertical scroll offset as a 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
impl_traversalEngine, needsLayout
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 | Field and Description |
---|---|
static int |
DEFAULT_GRID_CELL_HEIGHT
The default grid cell height.
|
static int |
DEFAULT_GRID_CELL_WIDTH
The default grid cell width.
|
static Color |
DEFAULT_GRID_POINT_COLOR
The default
Color that is used to draw grid points. |
USE_COMPUTED_SIZE, USE_PREF_SIZE
BASELINE_OFFSET_SAME_AS_HEIGHT
Constructor and Description |
---|
InfiniteCanvas()
Constructs a new
InfiniteCanvas . |
Modifier and Type | Method and Description |
---|---|
protected void |
clipContent()
Enables content clipping for this
InfiniteCanvas . |
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.
|
ReadOnlyObjectProperty<Bounds> |
contentBoundsProperty()
Provides the visual bounds of the content group in the local coordinate
system of this
InfiniteCanvas as a (read-only) property. |
ReadOnlyObjectProperty<Affine> |
contentTransformProperty()
Returns the viewport transform as a (read-only) property.
|
protected Region |
createGrid()
Creates the
Region that renders the grid (when it is enabled). |
protected Image |
createGridTile()
Locate or create an
Image that represents a single grid
cell/tile. |
protected List<? extends Node> |
createLayers()
Returns a list containing the top level layers in the visualization of
this
InfiniteCanvas . |
protected Group |
createScrollBarGroup()
Creates the
Group designated for holding the scrollbars and
places the scrollbars in it. |
protected List<? extends 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. |
Bounds |
getContentBounds()
Returns the value of the
contentBoundsProperty() . |
Group |
getContentGroup()
Returns the
Group designated for holding the scrolled content. |
Affine |
getContentTransform()
Returns the transformation that is applied to the
content group . |
protected 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() . |
ScrollBar |
getHorizontalScrollBar()
|
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.
|
Group |
getOverlayGroup()
Returns the overlay
Group that is rendered above the contents but
below the scrollbars. |
Bounds |
getScrollableBounds()
Returns the value of the
scrollableBoundsProperty() . |
protected Group |
getScrollBarGroup()
|
Group |
getScrolledOverlayGroup()
Returns the scrolled overlay
Group . |
protected Pane |
getScrolledPane()
Returns the
Pane which is translated when scrolling. |
Group |
getScrolledUnderlayGroup()
Returns the scrolled underlay
Group . |
Group |
getUnderlayGroup()
Returns the underlay
Group . |
ScrollBar |
getVerticalScrollBar()
|
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.
|
IntegerProperty |
gridCellHeightProperty()
Returns the grid cell height as a (writable) property.
|
IntegerProperty |
gridCellWidthProperty()
Returns the grid cell width as a (writable) property.
|
protected void |
hideGrid()
Disables the background grid.
|
ObjectProperty<ScrollPane.ScrollBarPolicy> |
horizontalScrollBarPolicyProperty()
Returns the
ObjectProperty that controls the
ScrollPane.ScrollBarPolicy that decides when to show a horizontal scrollbar. |
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(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. |
protected void |
repaintGrid()
Repaints the tile image that depends on the grid cell size only.
|
void |
reveal(Node child)
Ensures that the specified child
Node is visible to the user by
scrolling to its position. |
ReadOnlyObjectProperty<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(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(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(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.
|
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(Affine transform)
This method is called when the grid transformation should be updated to
match the given
Affine . |
protected void |
updateScrollBars()
Updates the
ScrollBar s' visibilities, value ranges and value
increments based on the content
bounds and the scrollable
bounds . |
ObjectProperty<ScrollPane.ScrollBarPolicy> |
verticalScrollBarPolicyProperty()
Returns the
ObjectProperty that controls the
ScrollPane.ScrollBarPolicy that decides when to show a vertical scrollbar. |
DoubleProperty |
verticalScrollOffsetProperty()
Returns the vertical scroll offset as a property.
|
protected void |
zoomGrid()
Enables zooming of the background grid when the contents are zoomed.
|
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 BooleanProperty clipContentProperty
BooleanProperty
that determines if this
InfiniteCanvas
does clipping, i.e. restricts its visibility to
its Node.layoutBoundsProperty()
.isClipContent()
,
setClipContent(boolean)
public ReadOnlyObjectProperty<Bounds> contentBoundsProperty
InfiniteCanvas
as a (read-only) property.getContentBounds()
public ReadOnlyObjectProperty<Affine> contentTransformProperty
getContentTransform()
,
setContentTransform(Affine)
public IntegerProperty gridCellHeightProperty
getGridCellHeight()
,
setGridCellHeight(int)
public IntegerProperty gridCellWidthProperty
getGridCellWidth()
,
setGridCellWidth(int)
public ObjectProperty<ScrollPane.ScrollBarPolicy> horizontalScrollBarPolicyProperty
ObjectProperty
that controls the
ScrollPane.ScrollBarPolicy
that decides when to show a horizontal scrollbar.getHorizontalScrollBarPolicy()
,
#setHorizontalScrollBarPolicy(ScrollBarPolicy)
public DoubleProperty horizontalScrollOffsetProperty
public ReadOnlyObjectProperty<Bounds> scrollableBoundsProperty
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.getScrollableBounds()
public BooleanProperty showGridProperty
BooleanProperty
that determines if a background grid
is shown within this InfiniteCanvas
.isShowGrid()
,
setShowGrid(boolean)
public ObjectProperty<ScrollPane.ScrollBarPolicy> verticalScrollBarPolicyProperty
ObjectProperty
that controls the
ScrollPane.ScrollBarPolicy
that decides when to show a vertical scrollbar.getVerticalScrollBarPolicy()
,
#setVerticalScrollBarPolicy(ScrollBarPolicy)
public DoubleProperty verticalScrollOffsetProperty
public BooleanProperty zoomGridProperty
BooleanProperty
that determines if the background
grid is zoomed when the contents are zoomed.isZoomGrid()
,
setZoomGrid(boolean)
public static final Color DEFAULT_GRID_POINT_COLOR
Color
that is used to draw grid points.public static final int DEFAULT_GRID_CELL_WIDTH
public static final int DEFAULT_GRID_CELL_HEIGHT
public InfiniteCanvas()
InfiniteCanvas
.protected void clipContent()
InfiniteCanvas
.public 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 ReadOnlyObjectProperty<Bounds> contentBoundsProperty()
InfiniteCanvas
as a (read-only) property.getContentBounds()
public ReadOnlyObjectProperty<Affine> contentTransformProperty()
getContentTransform()
,
setContentTransform(Affine)
protected Region createGrid()
Region
that renders the grid (when it is enabled).Region
that renders the grid.protected Image createGridTile()
Image
that represents a single grid
cell/tile. The Image
's dimensions is expected to match the grid
cell size (width and height).Image
that represents a single grid cell/tile.protected List<? extends 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 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 List<? extends 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.IllegalStateException
- when the content area is zero or the canvas area is zero.public Bounds getContentBounds()
contentBoundsProperty()
.contentBoundsProperty()
.public Group getContentGroup()
Group
designated for holding the scrolled content.Group
designated for holding the scrolled content.public Affine getContentTransform()
content group
.content group
.protected Region getGridCanvas()
Region
that is used to paint the background grid.Region
that is used to paint the background grid.public double getGridCellHeight()
gridCellHeightProperty()
.gridCellHeightProperty()
.public double getGridCellWidth()
gridCellWidthProperty()
.gridCellWidthProperty()
.public 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 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 Bounds getScrollableBounds()
scrollableBoundsProperty()
.scrollableBoundsProperty()
.protected Group getScrollBarGroup()
public Group getScrolledOverlayGroup()
Group
.Group
.protected 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 Group getScrolledUnderlayGroup()
Group
.Group
.public Group getUnderlayGroup()
Group
.Group
.public 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 IntegerProperty gridCellHeightProperty()
getGridCellHeight()
,
setGridCellHeight(int)
public IntegerProperty gridCellWidthProperty()
getGridCellWidth()
,
setGridCellWidth(int)
protected void hideGrid()
public ObjectProperty<ScrollPane.ScrollBarPolicy> horizontalScrollBarPolicyProperty()
ObjectProperty
that controls the
ScrollPane.ScrollBarPolicy
that decides when to show a horizontal scrollbar.getHorizontalScrollBarPolicy()
,
#setHorizontalScrollBarPolicy(ScrollBarPolicy)
public 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(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.protected void repaintGrid()
public void reveal(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.
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.
child
- The child Node
to reveal.public ReadOnlyObjectProperty<Bounds> scrollableBoundsProperty()
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.getScrollableBounds()
public void setClipContent(boolean clipContent)
clipContentProperty()
to the given value.clipContent
- The new value for the clipContentProperty()
.public void setContentTransform(Affine tx)
viewport transform
to the values specified by the given Affine
.tx
- The Affine
determining the new
viewport transform
.public void setGridCellHeight(int gridCellHeight)
gridCellHeightProperty()
.gridCellHeight
- The grid cell height that is assigned to the
gridCellHeightProperty()
.public void setGridCellWidth(int gridCellWidth)
gridCellWidthProperty()
.gridCellWidth
- The grid cell width that is assigned to the
gridCellWidthProperty()
.public void setHorizontalScrollBarPolicy(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(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 BooleanProperty showGridProperty()
BooleanProperty
that determines if a background grid
is shown within this InfiniteCanvas
.isShowGrid()
,
setShowGrid(boolean)
protected void unclipContent()
InfiniteCanvas
.protected void unregisterUpdateScrollBarsOnBoundsChanges()
registerUpdateScrollBarsOnBoundsChanges()
.protected void unzoomGrid()
zoomGrid()
,
zoomGridProperty()
protected void updateGridTransform(Affine transform)
Affine
. The grid transformation istransform
- The new transformation matrix for the grid canvas.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 ObjectProperty<ScrollPane.ScrollBarPolicy> verticalScrollBarPolicyProperty()
ObjectProperty
that controls the
ScrollPane.ScrollBarPolicy
that decides when to show a vertical scrollbar.getVerticalScrollBarPolicy()
,
#setVerticalScrollBarPolicy(ScrollBarPolicy)
public DoubleProperty verticalScrollOffsetProperty()
protected void zoomGrid()
public BooleanProperty zoomGridProperty()
BooleanProperty
that determines if the background
grid is zoomed when the contents are zoomed.isZoomGrid()
,
setZoomGrid(boolean)
Copyright (c) 2014, 2016 itemis AG and others. All rights reserved.