de.javagl.swogl.interaction
Class ScalingBehavior

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

public class ScalingBehavior
extends java.lang.Object

This class allows scaling 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 and MouseMotionListener by calling the main public methods accordingly:

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


Constructor Summary
ScalingBehavior(de.javagl.swogl.SwoglContainer swoglContainer)
          Creates a new ScalingBehavior for the given SwoglContainer.
 
Method Summary
 void doScaling(java.awt.Point point)
          Scale the current SwoglComponent.
 void setScalingSpeed(float scalingSpeed)
          Set the scaling speed factor
 void setUniformScaling(boolean uniformScaling)
          Set whether the scaling should be uniform
 void startScaling(java.awt.Point point)
          Start scaling the current SwoglComponent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScalingBehavior

public ScalingBehavior(de.javagl.swogl.SwoglContainer swoglContainer)
Creates a new ScalingBehavior for the given SwoglContainer.

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

startScaling

public void startScaling(java.awt.Point point)
Start scaling the current SwoglComponent. If a SwoglComponent is found inside the SwoglContainer at the given point, then subsequent calls to doScaling(Point) will scale the SwoglComponent.

Parameters:
point - The point where the scaling should start

doScaling

public void doScaling(java.awt.Point point)
Scale the current SwoglComponent. If no SwoglComponent was hit by the previous call to startScaling(Point), then this method does not have any effect. Otherwise, this method will scale the SwoglComponent depending on the difference between the given point and the previous point.

Parameters:
point - The current point

setScalingSpeed

public void setScalingSpeed(float scalingSpeed)
Set the scaling speed factor

Parameters:
scalingSpeed - The scaling speed factor

setUniformScaling

public void setUniformScaling(boolean uniformScaling)
Set whether the scaling should be uniform

Parameters:
uniformScaling - Whether the scaling should be uniform