public class DragContext
extends java.lang.Object
Dragable
nodes use a drag context to
implement dragging with a mouse.
A drag context is constructed from a pick result, which has a picked point in local coordinates, as well as transforms to world and pixel coordinates. Those local-to-world and and local-to-pixel transforms are assumed to be constant while the the mouse is being dragged. This assumption implies that the view must not change while dragging.
A drag context has a current mouse event and a current point, with local, world, and pixel coordinates. A mouse motion listener (not part of this context) is responsible for updating this context as the mouse is dragged. Updates modify the current mouse event and the current point maintained by this context.
Constructor and Description |
---|
DragContext(PickResult pr)
Constructs a drag context for the specified pick result.
|
Modifier and Type | Method and Description |
---|---|
Matrix44 |
getLocalToPixel()
Gets the local-to-pixel coordinate transform matrix.
|
Matrix44 |
getLocalToWorld()
Gets the local-to-world coordinate transform matrix.
|
java.awt.event.MouseEvent |
getMouseEvent()
Gets the current mouse event.
|
double |
getPixelZ()
Gets the pixel z (depth) coordinate of the current point.
|
Point3 |
getPointLocal()
Gets the current point in local coordinates.
|
Point3 |
getPointPixel()
Gets the current point in pixel coordinates.
|
Point3 |
getPointWorld()
Gets the current point in world coordinates.
|
View |
getView()
Gets the view for which this context was constructed.
|
ViewCanvas |
getViewCanvas()
Gets the canvas for which this context was constructed.
|
World |
getWorld()
Gets the world for which this context was constructed.
|
Matrix44 |
getWorldToPixel()
Gets the world-to-pixel coordinate transform matrix.
|
void |
update(java.awt.event.MouseEvent event)
Updates this drag context for the specified mouse event.
|
public DragContext(PickResult pr)
pr
- the pick result.public void update(java.awt.event.MouseEvent event)
event
- the mouse event.public ViewCanvas getViewCanvas()
public View getView()
public World getWorld()
public java.awt.event.MouseEvent getMouseEvent()
public Point3 getPointLocal()
public Point3 getPointWorld()
public Point3 getPointPixel()
public double getPixelZ()
public Matrix44 getLocalToWorld()
public Matrix44 getLocalToPixel()
public Matrix44 getWorldToPixel()