sub_arctic.input
Class std_drag_filters

java.lang.Object
  |
  +--sub_arctic.input.std_drag_filters

public class std_drag_filters
extends java.lang.Object

Utility class containing some standard move-drag filter functions. Filter functions allow drags to be limited to certain regions or provide various "effects" and transformations of the drag path. See move_drag_focus_agent for details on how drag filters are applied.

See Also:
move_drag_focus_agent

Method Summary
static java.awt.Point keep_in_parent(java.awt.Point pt, interactor limit_obj, int xsave, int ysave)
          Filter to keep at least a little bit of an object within the bounds of its parent.
static java.awt.Point limit_to_line_seg(java.awt.Point pt, int x1, int y1, int x2, int y2)
          Filter to limit points to line on a line segment.
static java.awt.Point limit_to_parent(java.awt.Point pt, interactor of_obj, boolean keep_br_in, int x_inset, int y_inset, java.awt.Point feature_pt)
          Filter to limit to within the bounds of the parent of a given object.
static java.awt.Point limit_to_rect(java.awt.Point pt, java.awt.Rectangle lim)
          Filter to limit to the inside of a given rectangle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

limit_to_rect

public static java.awt.Point limit_to_rect(java.awt.Point pt,
                                           java.awt.Rectangle lim)
Filter to limit to the inside of a given rectangle.
Parameters:
pt - the point to be filtered
lim - the rectangle it is limited to
Returns:
Point the filtered point

limit_to_parent

public static java.awt.Point limit_to_parent(java.awt.Point pt,
                                             interactor of_obj,
                                             boolean keep_br_in,
                                             int x_inset,
                                             int y_inset,
                                             java.awt.Point feature_pt)
Filter to limit to within the bounds of the parent of a given object. Limit can optionally keep the given right and bottom edges of the object within the parent and/or provide an inset from the parent.
Parameters:
pt - the point to be filtered
of_obj - the object being dragged
keep_br_in - true if we want to keep the bottom right inside the parent (this adds an extra inset)
x_inset - distance to inset right edge of limit from edge of parent
y_inset - distance to inset bottom edge of limit from edge of parent
feature_pt - location of feature point being filtered (in local coordinates of of_obj)
Returns:
Point the filtered point

keep_in_parent

public static java.awt.Point keep_in_parent(java.awt.Point pt,
                                            interactor limit_obj,
                                            int xsave,
                                            int ysave)
Filter to keep at least a little bit of an object within the bounds of its parent. This is set up assuming a top-left corner feature point.
Parameters:
pt - the point to be filtered.
limit_obj - the object being limited.
xsave - x amount to keep in bounds.
ysave - y amount to keep in bounds.
Returns:
Point the filtered point.

limit_to_line_seg

public static java.awt.Point limit_to_line_seg(java.awt.Point pt,
                                               int x1,
                                               int y1,
                                               int x2,
                                               int y2)
Filter to limit points to line on a line segment.
Parameters:
pt - the point being filtered
x1 - x coordinate of first line segment end point
y1 - y coordinate of first line segment end point
x2 - x coordinate of second line segment end point
y2 - y coordinate of second line segment end point
Returns:
Point filtered point (which lies on the line segment)