mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-29 08:36:10 +03:00
Merge pull request #754 from fs-webdev/master
Added a patch to help slow down the scroll devices that fire too fast…
This commit is contained in:
commit
db5949c2d7
@ -255,6 +255,11 @@
|
|||||||
* @property {Boolean} [preserveImageSizeOnResize=false]
|
* @property {Boolean} [preserveImageSizeOnResize=false]
|
||||||
* Set to true to have the image size preserved when the viewer is resized. This requires autoResize=true (default).
|
* Set to true to have the image size preserved when the viewer is resized. This requires autoResize=true (default).
|
||||||
*
|
*
|
||||||
|
* @property {Number} [minScrollDeltaTime=50]
|
||||||
|
* Number of milliseconds between canvas-scroll events. This value helps normalize the rate of canvas-scroll
|
||||||
|
* events between different devices, causing the faster devices to slow down enough to make the zoom control
|
||||||
|
* more manageable.
|
||||||
|
*
|
||||||
* @property {Number} [pixelsPerWheelLine=40]
|
* @property {Number} [pixelsPerWheelLine=40]
|
||||||
* For pixel-resolution scrolling devices, the number of pixels equal to one scroll line.
|
* For pixel-resolution scrolling devices, the number of pixels equal to one scroll line.
|
||||||
*
|
*
|
||||||
@ -1003,6 +1008,7 @@ if (typeof define === 'function' && define.amd) {
|
|||||||
pixelsPerWheelLine: 40,
|
pixelsPerWheelLine: 40,
|
||||||
autoResize: true,
|
autoResize: true,
|
||||||
preserveImageSizeOnResize: false, // requires autoResize=true
|
preserveImageSizeOnResize: false, // requires autoResize=true
|
||||||
|
minScrollDeltaTime: 50,
|
||||||
|
|
||||||
//DEFAULT CONTROL SETTINGS
|
//DEFAULT CONTROL SETTINGS
|
||||||
showSequenceControl: true, //SEQUENCE
|
showSequenceControl: true, //SEQUENCE
|
||||||
|
@ -203,6 +203,8 @@ $.Viewer = function( options ) {
|
|||||||
this._loadQueue = [];
|
this._loadQueue = [];
|
||||||
this.currentOverlays = [];
|
this.currentOverlays = [];
|
||||||
|
|
||||||
|
this._lastScrollTime = $.now(); // variable used to help normalize the scroll event speed of different devices
|
||||||
|
|
||||||
//Inherit some behaviors and properties
|
//Inherit some behaviors and properties
|
||||||
$.EventSource.call( this );
|
$.EventSource.call( this );
|
||||||
|
|
||||||
@ -2738,7 +2740,17 @@ function onCanvasPinch( event ) {
|
|||||||
|
|
||||||
function onCanvasScroll( event ) {
|
function onCanvasScroll( event ) {
|
||||||
var gestureSettings,
|
var gestureSettings,
|
||||||
factor;
|
factor,
|
||||||
|
thisScrollTime,
|
||||||
|
deltaScrollTime;
|
||||||
|
|
||||||
|
/* Certain scroll devices fire the scroll event way too fast so we are injecting a simple adjustment to keep things
|
||||||
|
* partially normalized. If we have already fired an event within the last 'minScrollDelta' milliseconds we skip
|
||||||
|
* this one and wait for the next event. */
|
||||||
|
thisScrollTime = $.now();
|
||||||
|
deltaScrollTime = thisScrollTime - this._lastScrollTime;
|
||||||
|
if (deltaScrollTime > this.minScrollDeltaTime) {
|
||||||
|
this._lastScrollTime = thisScrollTime;
|
||||||
|
|
||||||
if ( !event.preventDefaultAction && this.viewport ) {
|
if ( !event.preventDefaultAction && this.viewport ) {
|
||||||
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
|
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
|
||||||
@ -2772,11 +2784,14 @@ function onCanvasScroll( event ) {
|
|||||||
shift: event.shift,
|
shift: event.shift,
|
||||||
originalEvent: event.originalEvent
|
originalEvent: event.originalEvent
|
||||||
});
|
});
|
||||||
|
|
||||||
if (gestureSettings && gestureSettings.scrollToZoom) {
|
if (gestureSettings && gestureSettings.scrollToZoom) {
|
||||||
//cancels event
|
//cancels event
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false; // We are swallowing this event
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onContainerEnter( event ) {
|
function onContainerEnter( event ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user