Class OpenSeadragon.MouseTracker
- Defined in: openseadragon.js
Constructor Attributes | Constructor Name and Description |
---|---|
OpenSeadragon.MouseTracker(options)
The MouseTracker allows other classes to set handlers for common mouse
events on a specific element like, 'enter', 'exit', 'press', 'release',
'scroll', 'click', and 'drag'.
|
Method Summary
Class Detail
OpenSeadragon.MouseTracker(options)
The MouseTracker allows other classes to set handlers for common mouse
events on a specific element like, 'enter', 'exit', 'press', 'release',
'scroll', 'click', and 'drag'.
- Parameters:
- {Object} options
- Allows configurable properties to be entirely specified by passing an options object to the constructor. The constructor also supports the original positional arguments 'elements', 'clickTimeThreshold', and 'clickDistThreshold' in that order.
- {Element|String} options.element
- A reference to an element or an element id for which the mouse events will be monitored.
- {Number} options.clickTimeThreshold
- The number of milliseconds within which mutliple mouse clicks will be treated as a single event.
- {Number} options.clickDistThreshold
- The distance between mouse click within multiple mouse clicks will be treated as a single event.
- {Function} options.enterHandler
- An optional handler for mouse enter.
- {Function} options.exitHandler
- An optional handler for mouse exit.
- {Function} options.pressHandler
- An optional handler for mouse press.
- {Function} options.releaseHandler
- An optional handler for mouse release.
- {Function} options.scrollHandler
- An optional handler for mouse scroll.
- {Function} options.clickHandler
- An optional handler for mouse click.
- {Function} options.dragHandler
- An optional handler for mouse drag.
Field Detail
{Number}
clickDistThreshold
The distance between mouse click within multiple mouse clicks
will be treated as a single event.
{Number}
clickTimeThreshold
The number of milliseconds within which mutliple mouse clicks
will be treated as a single event.
{Element}
element
The element for which mouse event are being monitored.
{Number}
hash
An unique hash for this tracker.
Method Detail
-
clickHandler(tracker, position, quick, shift)Implement or assign implmentation to these handlers during or after calling the constructor.
- Parameters:
- {OpenSeadragon.MouseTracker} tracker
- A reference to the tracker instance.
- {OpenSeadragon.Point} position
- The poistion of the event on the screen.
- {Boolean} quick
- True only if the clickDistThreshold and clickDeltaThreshold are both pased. Useful for ignoring events.
- {Boolean} shift
- Was the shift key being pressed during this event?
-
dragHandler(tracker, position, delta, shift)Implement or assign implmentation to these handlers during or after calling the constructor.
- Parameters:
- {OpenSeadragon.MouseTracker} tracker
- A reference to the tracker instance.
- {OpenSeadragon.Point} position
- The poistion of the event on the screen.
- {OpenSeadragon.Point} delta
- The x,y components of the difference between start drag and end drag. Usefule for ignoring or weighting the events.
- {Boolean} shift
- Was the shift key being pressed during this event?
-
enterHandler(tracker, position, buttonDown, buttonDownAny)Implement or assign implmentation to these handlers during or after calling the constructor.
- Parameters:
- {OpenSeadragon.MouseTracker} tracker
- A reference to the tracker instance.
- {OpenSeadragon.Point} position
- The poistion of the event on the screen.
- {Boolean} buttonDown
- True if the left mouse button is currently being pressed and was initiated inside the tracked element, otherwise false.
- {Boolean} buttonDownAny
- Was the button down anywhere in the screen during the event.
-
exitHandler(tracker, position, buttonDown, buttonDownAny)Implement or assign implmentation to these handlers during or after calling the constructor.
- Parameters:
- {OpenSeadragon.MouseTracker} tracker
- A reference to the tracker instance.
- {OpenSeadragon.Point} position
- The poistion of the event on the screen.
- {Boolean} buttonDown
- True if the left mouse button is currently being pressed and was initiated inside the tracked element, otherwise false.
- {Boolean} buttonDownAny
- Was the button down anywhere in the screen during the event.
-
{Boolean} isTracking()Are we currently tracking events on this element.
- Deprecated:
- Just use this.tracking
- Returns:
- {Boolean} Are we currently tracking events on this element.
-
keyHandler(tracker, keyCode, shift)Implement or assign implmentation to these handlers during or after calling the constructor.
- Parameters:
- {OpenSeadragon.MouseTracker} tracker
- A reference to the tracker instance.
- {Number} keyCode
- The key code that was pressed.
- {Boolean} shift
- Was the shift key being pressed during this event?
-
pressHandler(tracker, position)Implement or assign implmentation to these handlers during or after calling the constructor.
- Parameters:
- {OpenSeadragon.MouseTracker} tracker
- A reference to the tracker instance.
- {OpenSeadragon.Point} position
- The poistion of the event on the screen.
-
releaseHandler(tracker, position, buttonDown, insideElementRelease)Implement or assign implmentation to these handlers during or after calling the constructor.
- Parameters:
- {OpenSeadragon.MouseTracker} tracker
- A reference to the tracker instance.
- {OpenSeadragon.Point} position
- The poistion of the event on the screen.
- {Boolean} buttonDown
- True if the left mouse button is currently being pressed and was initiated inside the tracked element, otherwise false.
- {Boolean} insideElementRelease
- Was the mouse still inside the tracked element when the button was released.
-
scrollHandler(tracker, position, scroll, shift)Implement or assign implmentation to these handlers during or after calling the constructor.
- Parameters:
- {OpenSeadragon.MouseTracker} tracker
- A reference to the tracker instance.
- {OpenSeadragon.Point} position
- The poistion of the event on the screen.
- {Number} scroll
- The scroll delta for the event.
- {Boolean} shift
- Was the shift key being pressed during this event?
-
{OpenSeadragon.MouseTracker} setTracking(track)Enable or disable whether or not we are tracking events on this element.
- Parameters:
- {Boolean} track
- True to start tracking, false to stop tracking.
- Returns:
- {OpenSeadragon.MouseTracker} Chainable.