public class FXPanOnTypePolicy extends AbstractInteractionPolicy<javafx.scene.Node> implements IFXOnTypePolicy
FXPanOnTypePolicy
is an IFXOnTypePolicy
that performs
viewport panning via the keyboard.adaptable
adaptable
IAdaptable.Bound.Impl<T extends IAdaptable>
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_SCROLL_AMOUNT_PER_SECOND
The default scroll amount per second, i.e. how many pixels the viewport
is moved per second.
|
Constructor and Description |
---|
FXPanOnTypePolicy() |
Modifier and Type | Method and Description |
---|---|
double |
getScrollAmountPerSecond()
Returns the amount of units scrolled per second when a direction key is
pressed.
|
protected boolean |
isPan(javafx.scene.input.KeyEvent event)
Returns
true if the given KeyEvent should trigger
panning. |
void |
pressed(javafx.scene.input.KeyEvent event)
This callback method is invoked when the user presses a key while the
host has keyboard focus.
|
void |
released(javafx.scene.input.KeyEvent event)
This callback method is invoked when the user releases a key while the
host has keyboard focus.
|
void |
typed(javafx.scene.input.KeyEvent event)
This callback method is invoked when the user types a unicode key while
the host has keyboard focus.
|
void |
unfocus()
This callback method is invoked when the viewer loses its focus while a
key press/release gesture is running.
|
protected void |
updateScrollPosition()
Computes the viewport translation and applies it to the
InfiniteCanvas of the host's viewer using the
FXChangeViewportPolicy . |
commit, init, restoreRefreshVisuals, rollback, storeAndDisableRefreshVisuals
adaptableProperty, getAdaptable, getHost, setAdaptable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
adaptableProperty, getAdaptable, setAdaptable
public static final double DEFAULT_SCROLL_AMOUNT_PER_SECOND
public double getScrollAmountPerSecond()
protected boolean isPan(javafx.scene.input.KeyEvent event)
true
if the given KeyEvent
should trigger
panning. Otherwise returns false
. Per default, will return
true
if <Up>
, <Down>
,
<Left>
, <Right>
event
- The KeyEvent
in question.true
to indicate that the given KeyEvent
should trigger panning, otherwise false
.public void pressed(javafx.scene.input.KeyEvent event)
IFXOnTypePolicy
pressed
in interface IFXOnTypePolicy
event
- The original KeyEvent
.public void released(javafx.scene.input.KeyEvent event)
IFXOnTypePolicy
released
in interface IFXOnTypePolicy
event
- The original KeyEvent
.public void typed(javafx.scene.input.KeyEvent event)
IFXOnTypePolicy
typed
in interface IFXOnTypePolicy
event
- The original KeyEvent
.public void unfocus()
IFXOnTypePolicy
unfocus
in interface IFXOnTypePolicy
protected void updateScrollPosition()
InfiniteCanvas
of the host's viewer using the
FXChangeViewportPolicy
.Copyright (c) 2014 itemis AG and others. All rights reserved.