|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.view.Graph2DViewMouseWheelZoomListener
public class Graph2DViewMouseWheelZoomListener
This class can be registered with the Graph2DView's canvas component
(Graph2DView.getCanvasComponent()) as a MouseWheelListener.
It will thereby add mouse wheel scrolling capabilities to
the Graph2DView. E.g.:
// get the view instance
Graph2DView view = getView();
// create the listener
Graph2DViewMouseWheelZoomListener mwzl = new Graph2DViewMouseWheelZoomListener();
// register it with the view's internal canvas component
view.getCanvasComponent().addMouseWheelListener(mwzl);
Note that this class can only be used with J2SE 1.4 or higher.

| Constructor Summary | |
|---|---|
Graph2DViewMouseWheelZoomListener()
Creates a new Graph2DViewMouseWheelZoomListener If it receives MouseWheelListener events that come from the canvas component of a Graph2DView (see Graph2DView.getCanvasComponent()), it
will zoom into or out of the Graph2DView. |
|
| Method Summary | |
|---|---|
protected void |
adjustWorldRect(Graph2DView view)
Adjusts the world rectangle that defines the accessible area of the given view after its zoom and clip has been changed. |
protected double |
calcZoom(double zoom,
int amount)
Calculates the new zoom level to be assigned to the canvas. |
double |
getMaximumZoom()
Gets the maximum zoom level of Graph2DView
that will be assigned when scrolling the mouse wheel. |
double |
getMinimumZoom()
Returns the minimum zoom level of Graph2DView
that will be assigned when scrolling the mouse wheel. |
protected boolean |
isCenterZoomEvent(MouseWheelEvent mwe)
Determines whether for the current event center zooming should be used. |
boolean |
isCenterZooming()
Returns the property centerZooming. |
boolean |
isDownInZooming()
Returns property downInZooming. |
void |
mouseWheelMoved(MouseWheelEvent e)
|
void |
setCenterZooming(boolean centerZooming)
Sets the property centerZooming. |
void |
setDownInZooming(boolean downIn)
Sets property downInZooming. |
void |
setMaximumZoom(double maximumZoom)
Sets the maximum zoom level of Graph2DView
that will be assigned when scrolling the mouse wheel. |
void |
setMinimumZoom(double minimumZoom)
Sets the minimum zoom level of Graph2DView
that will be assigned when scrolling the mouse wheel. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Graph2DViewMouseWheelZoomListener()
Graph2DView (see Graph2DView.getCanvasComponent()), it
will zoom into or out of the Graph2DView.
| Method Detail |
|---|
public void mouseWheelMoved(MouseWheelEvent e)
mouseWheelMoved in interface MouseWheelListener
protected double calcZoom(double zoom,
int amount)
zoom - the current zoom level set on the canvas.amount - the amount of scroll wheel rotation or units to scroll.protected void adjustWorldRect(Graph2DView view)
protected boolean isCenterZoomEvent(MouseWheelEvent mwe)
isCenterZooming() returns
false or the Event.CTRL_MASK flag is set in
mwe's modifiers.
mwe - the current MouseWheelEvent
true if center zooming should be usedpublic boolean isCenterZooming()
true.
public void setCenterZooming(boolean centerZooming)
centerZooming - whether to enable simple center zoomingpublic double getMaximumZoom()
Graph2DView
that will be assigned when scrolling the mouse wheel.
By default, this value is set to Double.MAX_VALUE.
public void setMaximumZoom(double maximumZoom)
Graph2DView
that will be assigned when scrolling the mouse wheel.
By default, this value is set to Double.MAX_VALUE.
public double getMinimumZoom()
Graph2DView
that will be assigned when scrolling the mouse wheel.
public void setMinimumZoom(double minimumZoom)
Graph2DView
that will be assigned when scrolling the mouse wheel.
By default, this value is set to Double.MIN_VALUE.
public boolean isDownInZooming()
downInZooming.
downInZooming.setDownInZooming(boolean)public void setDownInZooming(boolean downIn)
downInZooming. If set to true
scrolling down (using the mouse wheel) will be translated into a
zoom in action and scrolling up will be translated into
a zoom out action. By default, this property is set to
false, i.e. scrolling down triggers zoom out behavior and
scrolling up zoom in behavior.
downIn - if true, scrolling down will zoom in; otherwise
scrolling down will zoom out.
|
© Copyright 2000-2008, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||