jdraw.framework
Interface PointConstrainer


public interface PointConstrainer

A PointConstrainer is used to restrict the coordinates used when the mouse is clicked. The methods defined in this interface are used by the draw view.


Method Summary
 java.awt.Point constrainPoint(java.awt.Point p)
          Returns constrained coordinates for p, e.g. rounded to a grid.
 int getStepX(boolean right)
          Returns the horizontal step size when the selection is moved with the arrow keys.
 int getStepY(boolean down)
          Returns the vertical step size when the selection is moved with the arrow keys.
 

Method Detail

constrainPoint

public java.awt.Point constrainPoint(java.awt.Point p)
Returns constrained coordinates for p, e.g. rounded to a grid.

Parameters:
p - mouse coordinates
Returns:
constrained coordinates

getStepX

public int getStepX(boolean right)
Returns the horizontal step size when the selection is moved with the arrow keys.

Parameters:
right - true if selection is moved right; false otherwise
Returns:
step size in horizontal direction (positive result)

getStepY

public int getStepY(boolean down)
Returns the vertical step size when the selection is moved with the arrow keys.

Parameters:
down - true if selection is moved down; false otherwise
Returns:
step size in vertical direction (positive result)