|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.ViewMode y.view.MagnifierViewMode
public class MagnifierViewMode
View mode that lets you zoom into a view region locally, while preserving the original viewport of the view. The effect is similar to a magnifier that is moved over the view.
Field Summary |
---|
Fields inherited from class y.view.ViewMode |
---|
ACTIVE_PROPERTY, ACTIVE_VIEW_PROPERTY, CHILD_MODE_PROPERTY, EDITING_PROPERTY, GRAB_FOCUS_ENABLED_PROPERTY, lastClickEvent, lastDragEvent, lastMoveEvent, lastPressEvent, lastReleaseEvent, MODIFIER_MASK_PROPERTY, NAME_PROPERTY, originalX, originalY, PARENT_MODE_PROPERTY, view |
Constructor Summary | |
---|---|
MagnifierViewMode()
Creates a new MagnifierViewMode instance. |
Method Summary | |
---|---|
void |
activate(boolean activate)
Upon activation or deactivation the set of registered mouse wheel listeners will be changed. |
protected int |
calcRadius(int radius,
int amount)
Calculates and returns an updated magnifier radius. |
protected double |
calcZoom(double zoom,
int amount)
Calculates and returns an updated magnifier zoom level. |
protected Graph2DView |
createMagnifierView()
Creates, configures, and returns a Graph2DView that is used to
render the view content for the magnifier. |
int |
getMagnifierRadius()
Returns the radius of the magnifying glass. |
double |
getMagnifierZoomFactor()
Returns the zoom factor used for the magnifier view. |
boolean |
isMouseWheelEnabled()
Returns whether or not to activate mouse wheel functionality. |
void |
mouseDraggedLeft(double x,
double y)
Updates the location of the magnifier. |
void |
mouseDraggedRight(double x,
double y)
Updates the location of the magnifier. |
void |
mouseExited(java.awt.event.MouseEvent e)
Removes the magnifier from the view. |
void |
mouseMoved(double x,
double y)
Updates the location of the magnifier. |
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e)
Invoked when the mouse wheel is rotated. |
void |
setMagnifierRadius(int radius)
Sets the radius of the magnifying glass. |
void |
setMagnifierZoomFactor(double zoomFactor)
Sets the zoom factor used for the magnifier view. |
void |
setMouseWheelEnabled(boolean mouseWheelEnabled)
Whether or not to activate mouse wheel functionality. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MagnifierViewMode()
MagnifierViewMode
instance.
Method Detail |
---|
public void mouseMoved(double x, double y)
mouseMoved
in class ViewMode
x
- the x-coordinate of the mouse event in world coordinates.y
- the y-coordinate of the mouse event in world coordinates.public void mouseDraggedLeft(double x, double y)
mouseDraggedLeft
in class ViewMode
x
- the x-coordinate of the mouse event in world coordinates.y
- the y-coordinate of the mouse event in world coordinates.public void mouseDraggedRight(double x, double y)
mouseDraggedRight
in class ViewMode
x
- the x-coordinate of the mouse event in world coordinates.y
- the y-coordinate of the mouse event in world coordinates.public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
mouseExited
in class ViewMode
protected Graph2DView createMagnifierView()
Graph2DView
that is used to
render the view content for the magnifier.
By default this method adopts various settings of the mode's associated
Graph2DView
instance view
. It also
sets the paintDetailThreshold
to 0.0
.
Graph2DView
instance for magnified
display of graphs.public void activate(boolean activate)
activate
in class ViewMode
activate
- set true
when mode was activated
false
otherwisesetMouseWheelEnabled(boolean)
public void setMagnifierZoomFactor(double zoomFactor)
By default a zoom factor of 2.0
is used.
zoomFactor
- the magnification factorpublic double getMagnifierZoomFactor()
setMagnifierZoomFactor(double)
public void setMagnifierRadius(int radius)
By default a radius of 100
is used.
radius
- the radius of of the magnifying glass.public int getMagnifierRadius()
setMagnifierRadius(int)
public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
e
- the triggering mouse wheel event.protected int calcRadius(int radius, int amount)
radius
- the current magnifier radiusamount
- the amount of scroll wheel rotation or units to scroll. This value can be positive and negative.
protected double calcZoom(double zoom, int amount)
zoom
- the current magnifier zoom levelamount
- the amount of scroll wheel rotation or units to scroll. This value can be positive and negative.
public boolean isMouseWheelEnabled()
true
if mouse wheel support is active;
false
otherwise.public void setMouseWheelEnabled(boolean mouseWheelEnabled)
Note that when this feature is enabled, already registered mouse wheel listeners will be deregistered until this mode is deactivated again.
mouseWheelEnabled
- if true
mouse wheel support is
activated; if false
mouse wheel support is deactivated.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |