public class FXPanOrZoomOnScrollPolicy extends AbstractFXInteractionPolicy implements IFXOnScrollPolicy
FXPanOrZoomOnScrollPolicy
is an IFXOnScrollPolicy
that
pans (i.e. moves/scrolls) the viewport upon scrolling the mouse wheel.adaptable
adaptable
IAdaptable.Bound.Impl<T extends IAdaptable>
Constructor and Description |
---|
FXPanOrZoomOnScrollPolicy() |
Modifier and Type | Method and Description |
---|---|
protected Dimension |
computeDelta(javafx.scene.input.ScrollEvent event)
Computes the translation for the given
ScrollEvent . |
protected FXChangeViewportPolicy |
determineViewportPolicy()
Returns the
FXChangeViewportPolicy that is to be used for
changing the viewport. |
protected FXChangeViewportPolicy |
getViewportPolicy()
Returns the
FXChangeViewportPolicy that is used for changing the
viewport within the current scroll gesture. |
protected boolean |
isPan(javafx.scene.input.ScrollEvent event)
Returns
true if the given ScrollEvent should trigger
panning. |
protected boolean |
isStopped()
Returns
true if panning was stopped for the current scroll
gesture, because further panning would move past the content bounds. |
protected boolean |
isSwapDirection(javafx.scene.input.ScrollEvent event)
Returns
true if the pan direction should be inverted for the
given ScrollEvent . |
protected boolean |
isZoom(javafx.scene.input.ScrollEvent event)
Returns
true if the given ScrollEvent should trigger
zooming. |
void |
scroll(javafx.scene.input.ScrollEvent event)
This callback method is invoked when the user performs mouse scrolling
over the host.
|
void |
scrollAborted()
This callback method is invoked when a scroll gesture ends unexpectedly.
|
void |
scrollFinished()
This callback method is invoked when the user stopped to perform mouse
scrolling over the host.
|
void |
scrollStarted(javafx.scene.input.ScrollEvent event)
This callback method is invoked when the user starts to perform mouse
scrolling over the host.
|
protected void |
setStopped(boolean stopped)
Sets the stopped flag to the given value.
|
protected void |
setViewportPolicy(FXChangeViewportPolicy viewportPolicy)
Sets the
FXChangeViewportPolicy that is used to manipulate the
viewport for the current scroll gesture to the given value. |
protected boolean |
stopAtContentBounds(Dimension delta)
Determines if the given panning
Dimension would result in panning
past the contents. |
isRegistered, isRegisteredForHost
commit, init, restoreRefreshVisuals, rollback, storeAndDisableRefreshVisuals
adaptableProperty, getAdaptable, getHost, setAdaptable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
adaptableProperty, getAdaptable, setAdaptable
protected Dimension computeDelta(javafx.scene.input.ScrollEvent event)
ScrollEvent
. The
horizontal and vertical translation is inverted when
isSwapDirection(ScrollEvent)
returns true
.event
- The original ScrollEvent
.Dimension
storing the horizontal and vertical
translation.protected FXChangeViewportPolicy determineViewportPolicy()
FXChangeViewportPolicy
that is to be used for
changing the viewport. This method is called within
scrollStarted(ScrollEvent)
where the resulting policy is cached
(setViewportPolicy(FXChangeViewportPolicy)
) for the scroll
gesture.FXChangeViewportPolicy
that is to be used for
changing the viewport.protected FXChangeViewportPolicy getViewportPolicy()
FXChangeViewportPolicy
that is used for changing the
viewport within the current scroll gesture. This policy is set within
scrollStarted(ScrollEvent)
to the value determined by
determineViewportPolicy()
.FXChangeViewportPolicy
that is used for changing the
viewport within the current scroll gesture.protected boolean isPan(javafx.scene.input.ScrollEvent event)
true
if the given ScrollEvent
should trigger
panning. Otherwise returns false
.event
- The ScrollEvent
in question.true
to indicate that the given ScrollEvent
should trigger panning, otherwise false
.protected boolean isStopped()
true
if panning was stopped for the current scroll
gesture, because further panning would move past the content bounds.
Otherwise returns false
.true
if panning was stopped for the current scroll
gesture, otherwise false
.protected boolean isSwapDirection(javafx.scene.input.ScrollEvent event)
true
if the pan direction should be inverted for the
given ScrollEvent
. Otherwise returns false
.event
- The ScrollEvent
in question.true
if the pan direction should be inverted,
otherwise false
.protected boolean isZoom(javafx.scene.input.ScrollEvent event)
true
if the given ScrollEvent
should trigger
zooming. Otherwise returns false
. Per default, either
<Control>
or <Alt>
has to be
pressed so that true
is returned.event
- The ScrollEvent
in question.true
if the given ScrollEvent
should trigger
zooming, otherwise false
.public void scroll(javafx.scene.input.ScrollEvent event)
IFXOnScrollPolicy
scroll
in interface IFXOnScrollPolicy
event
- The original ScrollEvent
.public void scrollAborted()
IFXOnScrollPolicy
scrollAborted
in interface IFXOnScrollPolicy
public void scrollFinished()
IFXOnScrollPolicy
scrollFinished
in interface IFXOnScrollPolicy
public void scrollStarted(javafx.scene.input.ScrollEvent event)
IFXOnScrollPolicy
scrollStarted
in interface IFXOnScrollPolicy
event
- The original ScrollEvent
.protected void setStopped(boolean stopped)
stopped
- The new value for the stopped flag.protected void setViewportPolicy(FXChangeViewportPolicy viewportPolicy)
FXChangeViewportPolicy
that is used to manipulate the
viewport for the current scroll gesture to the given value.viewportPolicy
- The new FXChangeViewportPolicy
that is to be used to
manipulate the viewport for the current scroll gesture.protected boolean stopAtContentBounds(Dimension delta)
Copyright (c) 2014 itemis AG and others. All rights reserved.