de.javagl.swogl.interaction
Class MovingBehavior

java.lang.Object
  extended by de.javagl.swogl.interaction.MovingBehavior

public class MovingBehavior
extends java.lang.Object

This class allows moving the SwoglComponents of a SwoglContainer in space. It may be used for the cases where the SwoglContainer has no layout manager.

Usually this class will be controlled by a MouseListener, MouseMotionListener and MouseWheelListener by calling the main public methods accordingly:

However, different applications of these methods may be implemented by the client.


Constructor Summary
MovingBehavior(SwoglContainer swoglContainer)
          Creates a new MovingBehavior for the given SwoglContainer.
 
Method Summary
 void doMovement(java.awt.Point point, int deltaZ)
          Move the current SwoglComponent.
 void startMovement(java.awt.Point point)
          Start the movement of a SwoglComponent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MovingBehavior

public MovingBehavior(SwoglContainer swoglContainer)
Creates a new MovingBehavior for the given SwoglContainer.

Parameters:
swoglContainer - The SwoglContainer this behavior operates on
Method Detail

startMovement

public void startMovement(java.awt.Point point)
Start the movement of a SwoglComponent. If a SwoglComponent is found inside the SwoglContainer at the given point, then subsequent calls to doMovement(Point, int) will move the SwoglComponent.

Parameters:
point - The point where the movement should start

doMovement

public void doMovement(java.awt.Point point,
                       int deltaZ)
Move the current SwoglComponent. If no SwoglComponent was hit by the previous call to startMovement(Point), then this method does not have any effect. Otherwise, this method will move the SwoglComponent so that the position where it was picked will be at the position that is passed in as the argument, or along the viewing Z-axis by the given amount.

Parameters:
point - The point where the SwoglComponent should move to
deltaZ - The movement delta along the picking ray