package jdraw.framework;

import java.awt.Point;

/**
 * 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.
 *
 * @author  Dominik Gruntz
 * @version 2.0
 */
public interface PointConstrainer {
	
	/**
	 * Returns constrained coordinates for p, e.g. rounded to a grid.
	 * @param p mouse coordinates
	 * @return constrained coordinates
	 */
	Point constrainPoint(Point p);
	
	/**
	 * Returns the horizontal step size when the selection is moved with the arrow keys.
	 * @param right true if selection is moved right; false otherwise
	 * @return step size in horizontal direction (positive result)
	 */
	int getStepX(boolean right);

	/**
	 * Returns the vertical step size when the selection is moved with the arrow keys.
	 * @param down true if selection is moved down; false otherwise
	 * @return step size in vertical direction (positive result)
	 */
	int getStepY(boolean down);
}
