public class PDefaultScrollDirector extends Object implements PScrollDirector, PropertyChangeListener
| Modifier and Type | Field and Description |
|---|---|
protected PCamera |
camera
The canvas' camera.
|
protected PRoot |
root
The canvas' root.
|
protected boolean |
scrollInProgress
Flag to indicate when scrolling is currently in progress.
|
protected PScrollPane |
scrollPane
The scrollpane that contains the viewport.
|
protected PCanvas |
view
The canvas that this class directs.
|
protected PViewport |
viewPort
The viewport that signals this scroll director.
|
| Constructor and Description |
|---|
PDefaultScrollDirector()
The default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Point |
getViewPosition(Rectangle2D viewBounds)
Get the View position given the specified camera bounds.
|
Dimension |
getViewSize(Rectangle2D viewBounds)
Get the size of the view based on the specified camera bounds.
|
void |
install(PViewport targetViewPort,
PCanvas targetView)
Installs the scroll director and adds the appropriate listeners.
|
void |
propertyChange(PropertyChangeEvent pce)
Invoked when the camera's view changes, or the bounds of the root or
camera changes.
|
void |
setViewPosition(double x,
double y)
Set the view position in a manner consistent with standardized scrolling.
|
boolean |
shouldRevalidateScrollPane()
Should the ScrollPane be revalidated.
|
void |
unInstall()
Uninstall the scroll director from the viewport.
|
protected PViewport viewPort
protected PScrollPane scrollPane
protected PCanvas view
protected PCamera camera
protected PRoot root
protected boolean scrollInProgress
public void install(PViewport targetViewPort, PCanvas targetView)
install in interface PScrollDirectortargetViewPort - viewport on which this director directstargetView - PCanvas that the viewport looks atpublic void unInstall()
unInstall in interface PScrollDirectorpublic Point getViewPosition(Rectangle2D viewBounds)
getViewPosition in interface PScrollDirectorviewBounds - The bounds for which the view position will be computedpublic Dimension getViewSize(Rectangle2D viewBounds)
getViewSize in interface PScrollDirectorviewBounds - The view bounds for which the view size will be
computedpublic void setViewPosition(double x,
double y)
setViewPosition in interface PScrollDirectorx - The new x positiony - The new y positionpublic void propertyChange(PropertyChangeEvent pce)
propertyChange in interface PropertyChangeListenerpce - property change event to examinepublic boolean shouldRevalidateScrollPane()
Copyright © 1995-2012 Piccolo2D. All Rights Reserved.