mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
Merge pull request #1423 from jetic83/master
Added optional zoom in the middle of the image instead of pointer position.
This commit is contained in:
commit
053332e282
@ -314,6 +314,8 @@
|
|||||||
* @property {Boolean} [gestureSettingsMouse.dblClickToZoom=false] - Zoom on double-click gesture. Note: If set to true
|
* @property {Boolean} [gestureSettingsMouse.dblClickToZoom=false] - Zoom on double-click gesture. Note: If set to true
|
||||||
* then clickToZoom should be set to false to prevent multiple zooms.
|
* then clickToZoom should be set to false to prevent multiple zooms.
|
||||||
* @property {Boolean} [gestureSettingsMouse.pinchToZoom=false] - Zoom on pinch gesture
|
* @property {Boolean} [gestureSettingsMouse.pinchToZoom=false] - Zoom on pinch gesture
|
||||||
|
* @property {Boolean} [gestureSettingsMouse.zoomToRefPoint=true] - If zoomToRefPoint is true, the zoom is centered at the pointer position. Otherwise,
|
||||||
|
* the zoom is centered at the canvas center.
|
||||||
* @property {Boolean} [gestureSettingsMouse.flickEnabled=false] - Enable flick gesture
|
* @property {Boolean} [gestureSettingsMouse.flickEnabled=false] - Enable flick gesture
|
||||||
* @property {Number} [gestureSettingsMouse.flickMinSpeed=120] - If flickEnabled is true, the minimum speed to initiate a flick gesture (pixels-per-second)
|
* @property {Number} [gestureSettingsMouse.flickMinSpeed=120] - If flickEnabled is true, the minimum speed to initiate a flick gesture (pixels-per-second)
|
||||||
* @property {Number} [gestureSettingsMouse.flickMomentum=0.25] - If flickEnabled is true, the momentum factor for the flick gesture
|
* @property {Number} [gestureSettingsMouse.flickMomentum=0.25] - If flickEnabled is true, the momentum factor for the flick gesture
|
||||||
@ -326,6 +328,8 @@
|
|||||||
* @property {Boolean} [gestureSettingsTouch.dblClickToZoom=true] - Zoom on double-click gesture. Note: If set to true
|
* @property {Boolean} [gestureSettingsTouch.dblClickToZoom=true] - Zoom on double-click gesture. Note: If set to true
|
||||||
* then clickToZoom should be set to false to prevent multiple zooms.
|
* then clickToZoom should be set to false to prevent multiple zooms.
|
||||||
* @property {Boolean} [gestureSettingsTouch.pinchToZoom=true] - Zoom on pinch gesture
|
* @property {Boolean} [gestureSettingsTouch.pinchToZoom=true] - Zoom on pinch gesture
|
||||||
|
* @property {Boolean} [gestureSettingsTouch.zoomToRefPoint=true] - If zoomToRefPoint is true, the zoom is centered at the pointer position. Otherwise,
|
||||||
|
* the zoom is centered at the canvas center.
|
||||||
* @property {Boolean} [gestureSettingsTouch.flickEnabled=true] - Enable flick gesture
|
* @property {Boolean} [gestureSettingsTouch.flickEnabled=true] - Enable flick gesture
|
||||||
* @property {Number} [gestureSettingsTouch.flickMinSpeed=120] - If flickEnabled is true, the minimum speed to initiate a flick gesture (pixels-per-second)
|
* @property {Number} [gestureSettingsTouch.flickMinSpeed=120] - If flickEnabled is true, the minimum speed to initiate a flick gesture (pixels-per-second)
|
||||||
* @property {Number} [gestureSettingsTouch.flickMomentum=0.25] - If flickEnabled is true, the momentum factor for the flick gesture
|
* @property {Number} [gestureSettingsTouch.flickMomentum=0.25] - If flickEnabled is true, the momentum factor for the flick gesture
|
||||||
@ -338,6 +342,8 @@
|
|||||||
* @property {Boolean} [gestureSettingsPen.dblClickToZoom=false] - Zoom on double-click gesture. Note: If set to true
|
* @property {Boolean} [gestureSettingsPen.dblClickToZoom=false] - Zoom on double-click gesture. Note: If set to true
|
||||||
* then clickToZoom should be set to false to prevent multiple zooms.
|
* then clickToZoom should be set to false to prevent multiple zooms.
|
||||||
* @property {Boolean} [gestureSettingsPen.pinchToZoom=false] - Zoom on pinch gesture
|
* @property {Boolean} [gestureSettingsPen.pinchToZoom=false] - Zoom on pinch gesture
|
||||||
|
* @property {Boolean} [gestureSettingsPan.zoomToRefPoint=true] - If zoomToRefPoint is true, the zoom is centered at the pointer position. Otherwise,
|
||||||
|
* the zoom is centered at the canvas center.
|
||||||
* @property {Boolean} [gestureSettingsPen.flickEnabled=false] - Enable flick gesture
|
* @property {Boolean} [gestureSettingsPen.flickEnabled=false] - Enable flick gesture
|
||||||
* @property {Number} [gestureSettingsPen.flickMinSpeed=120] - If flickEnabled is true, the minimum speed to initiate a flick gesture (pixels-per-second)
|
* @property {Number} [gestureSettingsPen.flickMinSpeed=120] - If flickEnabled is true, the minimum speed to initiate a flick gesture (pixels-per-second)
|
||||||
* @property {Number} [gestureSettingsPen.flickMomentum=0.25] - If flickEnabled is true, the momentum factor for the flick gesture
|
* @property {Number} [gestureSettingsPen.flickMomentum=0.25] - If flickEnabled is true, the momentum factor for the flick gesture
|
||||||
@ -350,6 +356,8 @@
|
|||||||
* @property {Boolean} [gestureSettingsUnknown.dblClickToZoom=true] - Zoom on double-click gesture. Note: If set to true
|
* @property {Boolean} [gestureSettingsUnknown.dblClickToZoom=true] - Zoom on double-click gesture. Note: If set to true
|
||||||
* then clickToZoom should be set to false to prevent multiple zooms.
|
* then clickToZoom should be set to false to prevent multiple zooms.
|
||||||
* @property {Boolean} [gestureSettingsUnknown.pinchToZoom=true] - Zoom on pinch gesture
|
* @property {Boolean} [gestureSettingsUnknown.pinchToZoom=true] - Zoom on pinch gesture
|
||||||
|
* @property {Boolean} [gestureSettingsUnknown.zoomToRefPoint=true] - If zoomToRefPoint is true, the zoom is centered at the pointer position. Otherwise,
|
||||||
|
* the zoom is centered at the canvas center.
|
||||||
* @property {Boolean} [gestureSettingsUnknown.flickEnabled=true] - Enable flick gesture
|
* @property {Boolean} [gestureSettingsUnknown.flickEnabled=true] - Enable flick gesture
|
||||||
* @property {Number} [gestureSettingsUnknown.flickMinSpeed=120] - If flickEnabled is true, the minimum speed to initiate a flick gesture (pixels-per-second)
|
* @property {Number} [gestureSettingsUnknown.flickMinSpeed=120] - If flickEnabled is true, the minimum speed to initiate a flick gesture (pixels-per-second)
|
||||||
* @property {Number} [gestureSettingsUnknown.flickMomentum=0.25] - If flickEnabled is true, the momentum factor for the flick gesture
|
* @property {Number} [gestureSettingsUnknown.flickMomentum=0.25] - If flickEnabled is true, the momentum factor for the flick gesture
|
||||||
@ -1044,6 +1052,7 @@ function OpenSeadragon( options ){
|
|||||||
clickToZoom: true,
|
clickToZoom: true,
|
||||||
dblClickToZoom: false,
|
dblClickToZoom: false,
|
||||||
pinchToZoom: false,
|
pinchToZoom: false,
|
||||||
|
zoomToRefPoint: true,
|
||||||
flickEnabled: false,
|
flickEnabled: false,
|
||||||
flickMinSpeed: 120,
|
flickMinSpeed: 120,
|
||||||
flickMomentum: 0.25,
|
flickMomentum: 0.25,
|
||||||
@ -1054,6 +1063,7 @@ function OpenSeadragon( options ){
|
|||||||
clickToZoom: false,
|
clickToZoom: false,
|
||||||
dblClickToZoom: true,
|
dblClickToZoom: true,
|
||||||
pinchToZoom: true,
|
pinchToZoom: true,
|
||||||
|
zoomToRefPoint: true,
|
||||||
flickEnabled: true,
|
flickEnabled: true,
|
||||||
flickMinSpeed: 120,
|
flickMinSpeed: 120,
|
||||||
flickMomentum: 0.25,
|
flickMomentum: 0.25,
|
||||||
@ -1064,6 +1074,7 @@ function OpenSeadragon( options ){
|
|||||||
clickToZoom: true,
|
clickToZoom: true,
|
||||||
dblClickToZoom: false,
|
dblClickToZoom: false,
|
||||||
pinchToZoom: false,
|
pinchToZoom: false,
|
||||||
|
zoomToRefPoint: true,
|
||||||
flickEnabled: false,
|
flickEnabled: false,
|
||||||
flickMinSpeed: 120,
|
flickMinSpeed: 120,
|
||||||
flickMomentum: 0.25,
|
flickMomentum: 0.25,
|
||||||
@ -1074,6 +1085,7 @@ function OpenSeadragon( options ){
|
|||||||
clickToZoom: false,
|
clickToZoom: false,
|
||||||
dblClickToZoom: true,
|
dblClickToZoom: true,
|
||||||
pinchToZoom: true,
|
pinchToZoom: true,
|
||||||
|
zoomToRefPoint: true,
|
||||||
flickEnabled: true,
|
flickEnabled: true,
|
||||||
flickMinSpeed: 120,
|
flickMinSpeed: 120,
|
||||||
flickMomentum: 0.25,
|
flickMomentum: 0.25,
|
||||||
|
@ -2652,7 +2652,7 @@ function onCanvasClick( event ) {
|
|||||||
if ( gestureSettings.clickToZoom ) {
|
if ( gestureSettings.clickToZoom ) {
|
||||||
this.viewport.zoomBy(
|
this.viewport.zoomBy(
|
||||||
event.shift ? 1.0 / this.zoomPerClick : this.zoomPerClick,
|
event.shift ? 1.0 / this.zoomPerClick : this.zoomPerClick,
|
||||||
this.viewport.pointFromPixel( event.position, true )
|
gestureSettings.zoomToRefPoint ? this.viewport.pointFromPixel( event.position, true ) : null
|
||||||
);
|
);
|
||||||
this.viewport.applyConstraints();
|
this.viewport.applyConstraints();
|
||||||
}
|
}
|
||||||
@ -2691,7 +2691,7 @@ function onCanvasDblClick( event ) {
|
|||||||
if ( gestureSettings.dblClickToZoom ) {
|
if ( gestureSettings.dblClickToZoom ) {
|
||||||
this.viewport.zoomBy(
|
this.viewport.zoomBy(
|
||||||
event.shift ? 1.0 / this.zoomPerClick : this.zoomPerClick,
|
event.shift ? 1.0 / this.zoomPerClick : this.zoomPerClick,
|
||||||
this.viewport.pointFromPixel( event.position, true )
|
gestureSettings.zoomToRefPoint ? this.viewport.pointFromPixel( event.position, true ) : null
|
||||||
);
|
);
|
||||||
this.viewport.applyConstraints();
|
this.viewport.applyConstraints();
|
||||||
}
|
}
|
||||||
@ -3005,7 +3005,9 @@ function onCanvasPinch( event ) {
|
|||||||
panByPt.y = 0;
|
panByPt.y = 0;
|
||||||
}
|
}
|
||||||
this.viewport.zoomBy( event.distance / event.lastDistance, centerPt, true );
|
this.viewport.zoomBy( event.distance / event.lastDistance, centerPt, true );
|
||||||
|
if ( gestureSettings.zoomToRefPoint ) {
|
||||||
this.viewport.panBy(panByPt, true);
|
this.viewport.panBy(panByPt, true);
|
||||||
|
}
|
||||||
this.viewport.applyConstraints();
|
this.viewport.applyConstraints();
|
||||||
}
|
}
|
||||||
if ( gestureSettings.pinchRotate ) {
|
if ( gestureSettings.pinchRotate ) {
|
||||||
@ -3068,7 +3070,7 @@ function onCanvasScroll( event ) {
|
|||||||
factor = Math.pow( this.zoomPerScroll, event.scroll );
|
factor = Math.pow( this.zoomPerScroll, event.scroll );
|
||||||
this.viewport.zoomBy(
|
this.viewport.zoomBy(
|
||||||
factor,
|
factor,
|
||||||
this.viewport.pointFromPixel( event.position, true )
|
gestureSettings.zoomToRefPoint ? this.viewport.pointFromPixel( event.position, true ) : null
|
||||||
);
|
);
|
||||||
this.viewport.applyConstraints();
|
this.viewport.applyConstraints();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user