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
|
||||
* @private
|
||||
* @param {OpenSeadragon.Rect} bounds
|
||||
* @param {Boolean} immediately
|
||||
* @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;
|
||||
},
|
||||
|
||||
@ -416,22 +433,6 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
|
||||
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;
|
||||
},
|
||||
|
||||
@ -445,14 +446,15 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
|
||||
|
||||
/**
|
||||
* @function
|
||||
* @private
|
||||
* @param {OpenSeadragon.Rect} bounds
|
||||
* @param {Object} options (immediately=null, constraints=false)
|
||||
* @param {Object} options (immediately=false, constraints=false)
|
||||
* @return {OpenSeadragon.Viewport} Chainable.
|
||||
*/
|
||||
_fitBounds: function( bounds, options ) {
|
||||
var newOptions = options || {};
|
||||
var immediately = newOptions.immediately || null;
|
||||
var constraints = newOptions.constraints || false;
|
||||
options = options || {};
|
||||
var immediately = options.immediately || false;
|
||||
var constraints = options.constraints || false;
|
||||
|
||||
var aspect = this.getAspectRatio(),
|
||||
center = bounds.getCenter(),
|
||||
@ -503,22 +505,6 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
|
||||
}
|
||||
|
||||
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 ) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>OpenSeadragon Memory Check Demo</title>
|
||||
<title>OpenSeadragon fitBoundsWithConstraints() Demo</title>
|
||||
<script type="text/javascript" src='../../build/openseadragon/openseadragon.js'></script>
|
||||
<style type="text/css">
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user