mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-24 22:26:10 +03:00
Merge pull request #1484 from francescocretti/hotfix/minimapDrag
preventDefaultAction in canvas-drag on minimap
This commit is contained in:
commit
7b73768b3b
@ -443,7 +443,36 @@ function onCanvasClick( event ) {
|
||||
* @function
|
||||
*/
|
||||
function onCanvasDrag( event ) {
|
||||
if ( this.viewer.viewport ) {
|
||||
var canvasDragEventArgs = {
|
||||
tracker: event.eventSource,
|
||||
position: event.position,
|
||||
delta: event.delta,
|
||||
speed: event.speed,
|
||||
direction: event.direction,
|
||||
shift: event.shift,
|
||||
originalEvent: event.originalEvent,
|
||||
preventDefaultAction: event.preventDefaultAction
|
||||
};
|
||||
/**
|
||||
* Raised when a drag event occurs on the {@link OpenSeadragon.Viewer#navigator} element.
|
||||
*
|
||||
* @event navigator-drag
|
||||
* @memberof OpenSeadragon.Viewer
|
||||
* @type {object}
|
||||
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised this event.
|
||||
* @property {OpenSeadragon.MouseTracker} tracker - A reference to the MouseTracker which originated this event.
|
||||
* @property {OpenSeadragon.Point} position - The position of the event relative to the tracked element.
|
||||
* @property {OpenSeadragon.Point} delta - The x,y components of the difference between start drag and end drag.
|
||||
* @property {Number} speed - Current computed speed, in pixels per second.
|
||||
* @property {Number} direction - Current computed direction, expressed as an angle counterclockwise relative to the positive X axis (-pi to pi, in radians). Only valid if speed > 0.
|
||||
* @property {Boolean} shift - True if the shift key was pressed during this event.
|
||||
* @property {Object} originalEvent - The original DOM event.
|
||||
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
||||
* @property {Boolean} preventDefaultAction - Set to true to prevent default click to zoom behaviour. Default: false.
|
||||
*/
|
||||
this.viewer.raiseEvent('navigator-drag', canvasDragEventArgs);
|
||||
|
||||
if ( !canvasDragEventArgs.preventDefaultAction && this.viewer.viewport ) {
|
||||
if( !this.panHorizontal ){
|
||||
event.delta.x = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user