mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
Cleanup for PR comments
- raise 'constrain' event inside applyBoundaryConstraints - fix demo title/filename - various fixes (default immediately to false + add private for documentation)
This commit is contained in:
parent
9e6c46d484
commit
318071d3ce
@ -322,6 +322,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @function
|
* @function
|
||||||
|
* @private
|
||||||
* @param {OpenSeadragon.Rect} bounds
|
* @param {OpenSeadragon.Rect} bounds
|
||||||
* @param {Boolean} immediately
|
* @param {Boolean} immediately
|
||||||
* @return {OpenSeadragon.Rect} constrained bounds.
|
* @return {OpenSeadragon.Rect} constrained bounds.
|
||||||
@ -387,6 +388,22 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( this.viewer ){
|
||||||
|
/**
|
||||||
|
* Raised when the viewport constraints are applied (see {@link OpenSeadragon.Viewport#applyConstraints}).
|
||||||
|
*
|
||||||
|
* @event constrain
|
||||||
|
* @memberof OpenSeadragon.Viewer
|
||||||
|
* @type {object}
|
||||||
|
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised this event.
|
||||||
|
* @property {Boolean} immediately
|
||||||
|
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
||||||
|
*/
|
||||||
|
this.viewer.raiseEvent( 'constrain', {
|
||||||
|
immediately: immediately
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return newBounds;
|
return newBounds;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -415,23 +432,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
|
|||||||
if ( bounds.x !== constrainedBounds.x || bounds.y !== constrainedBounds.y || immediately ){
|
if ( bounds.x !== constrainedBounds.x || bounds.y !== constrainedBounds.y || immediately ){
|
||||||
this.fitBounds( constrainedBounds, immediately );
|
this.fitBounds( constrainedBounds, immediately );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( this.viewer ){
|
|
||||||
/**
|
|
||||||
* Raised when the viewport constraints are applied (see {@link OpenSeadragon.Viewport#applyConstraints}).
|
|
||||||
*
|
|
||||||
* @event constrain
|
|
||||||
* @memberof OpenSeadragon.Viewer
|
|
||||||
* @type {object}
|
|
||||||
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised this event.
|
|
||||||
* @property {Boolean} immediately
|
|
||||||
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
|
||||||
*/
|
|
||||||
this.viewer.raiseEvent( 'constrain', {
|
|
||||||
immediately: immediately
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -445,14 +446,15 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @function
|
* @function
|
||||||
|
* @private
|
||||||
* @param {OpenSeadragon.Rect} bounds
|
* @param {OpenSeadragon.Rect} bounds
|
||||||
* @param {Object} options (immediately=null, constraints=false)
|
* @param {Object} options (immediately=false, constraints=false)
|
||||||
* @return {OpenSeadragon.Viewport} Chainable.
|
* @return {OpenSeadragon.Viewport} Chainable.
|
||||||
*/
|
*/
|
||||||
_fitBounds: function( bounds, options ) {
|
_fitBounds: function( bounds, options ) {
|
||||||
var newOptions = options || {};
|
options = options || {};
|
||||||
var immediately = newOptions.immediately || null;
|
var immediately = options.immediately || false;
|
||||||
var constraints = newOptions.constraints || false;
|
var constraints = options.constraints || false;
|
||||||
|
|
||||||
var aspect = this.getAspectRatio(),
|
var aspect = this.getAspectRatio(),
|
||||||
center = bounds.getCenter(),
|
center = bounds.getCenter(),
|
||||||
@ -503,22 +505,6 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
|
|||||||
}
|
}
|
||||||
|
|
||||||
newBounds = this._applyBoundaryConstraints( newBounds, immediately );
|
newBounds = this._applyBoundaryConstraints( newBounds, immediately );
|
||||||
|
|
||||||
if( this.viewer ){
|
|
||||||
/**
|
|
||||||
* Raised when the viewport constraints are applied (see {@link OpenSeadragon.Viewport#applyConstraints}).
|
|
||||||
*
|
|
||||||
* @event constrain
|
|
||||||
* @memberof OpenSeadragon.Viewer
|
|
||||||
* @type {object}
|
|
||||||
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised this event.
|
|
||||||
* @property {Boolean} immediately
|
|
||||||
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
|
||||||
*/
|
|
||||||
this.viewer.raiseEvent( 'constrain', {
|
|
||||||
immediately: immediately
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( newZoom == oldZoom || newBounds.width == oldBounds.width ) {
|
if ( newZoom == oldZoom || newBounds.width == oldBounds.width ) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>OpenSeadragon Memory Check Demo</title>
|
<title>OpenSeadragon fitBoundsWithConstraints() Demo</title>
|
||||||
<script type="text/javascript" src='../../build/openseadragon/openseadragon.js'></script>
|
<script type="text/javascript" src='../../build/openseadragon/openseadragon.js'></script>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user