1 /** 2 * Abstract; see an implementing class for details. 3 * 4 * @class Represents a reusable interaction; applies an interactive behavior to 5 * a given mark. Behaviors are themselves functions designed to be used as event 6 * handlers. For example, to add pan and zoom support to any panel, say: 7 * 8 * <pre> .event("mousedown", pv.Behavior.pan()) 9 * .event("mousewheel", pv.Behavior.zoom())</pre> 10 * 11 * The behavior should be registered on the event that triggers the start of the 12 * behavior. Typically, the behavior will take care of registering for any 13 * additional events that are necessary. For example, dragging starts on 14 * mousedown, while the drag behavior automatically listens for mousemove and 15 * mouseup events on the window. By listening to the window, the behavior can 16 * continue to receive mouse events even if the mouse briefly leaves the mark 17 * being dragged, or even the root panel. 18 * 19 * <p>Each behavior implementation has specific requirements as to which events 20 * it supports, and how it should be used. For example, the drag behavior 21 * requires that the data associated with the mark be an object with <tt>x</tt> 22 * and <tt>y</tt> attributes, such as a {@link pv.Vector}, storing the mark's 23 * position. See an implementing class for details. 24 * 25 * @see pv.Behavior.drag 26 * @see pv.Behavior.pan 27 * @see pv.Behavior.point 28 * @see pv.Behavior.select 29 * @see pv.Behavior.zoom 30 * @extends function 31 */ 32 pv.Behavior = {}; 33