mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-29 16:46:08 +03:00
cleaning up config related strategies. still not happy with current implementation, though now only Viewer and Viewport directly reference a .config
This commit is contained in:
parent
e73ed421e4
commit
8dc4c63f64
@ -6,7 +6,7 @@
|
|||||||
PROJECT: openseadragon
|
PROJECT: openseadragon
|
||||||
BUILD_MAJOR: 0
|
BUILD_MAJOR: 0
|
||||||
BUILD_MINOR: 9
|
BUILD_MINOR: 9
|
||||||
BUILD_ID: 13
|
BUILD_ID: 14
|
||||||
BUILD: ${PROJECT}.${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}
|
BUILD: ${PROJECT}.${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}
|
||||||
VERSION: ${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}
|
VERSION: ${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}
|
||||||
|
|
||||||
|
297
openseadragon.js
297
openseadragon.js
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @version OpenSeadragon 0.9.13
|
* @version OpenSeadragon 0.9.14
|
||||||
*
|
*
|
||||||
* @fileOverview
|
* @fileOverview
|
||||||
* <h2>
|
* <h2>
|
||||||
@ -90,6 +90,58 @@ OpenSeadragon = window.OpenSeadragon || (function(){
|
|||||||
indexOf = Array.prototype.indexOf;
|
indexOf = Array.prototype.indexOf;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
|
DEFAULT_SETTINGS: {
|
||||||
|
debugMode: true,
|
||||||
|
animationTime: 1.5,
|
||||||
|
blendTime: 0.5,
|
||||||
|
alwaysBlend: false,
|
||||||
|
autoHideControls: true,
|
||||||
|
immediateRender: false,
|
||||||
|
wrapHorizontal: false,
|
||||||
|
wrapVertical: false,
|
||||||
|
minZoomImageRatio: 0.8,
|
||||||
|
maxZoomPixelRatio: 2,
|
||||||
|
visibilityRatio: 0.5,
|
||||||
|
springStiffness: 5.0,
|
||||||
|
imageLoaderLimit: 0,
|
||||||
|
clickTimeThreshold: 200,
|
||||||
|
clickDistThreshold: 5,
|
||||||
|
zoomPerClick: 2.0,
|
||||||
|
zoomPerScroll: 1.2,
|
||||||
|
zoomPerSecond: 2.0,
|
||||||
|
showNavigationControl: true,
|
||||||
|
maxImageCacheCount: 100,
|
||||||
|
minPixelRatio: 0.5,
|
||||||
|
mouseNavEnabled: true,
|
||||||
|
navImages: {
|
||||||
|
zoomIn: {
|
||||||
|
REST: '/images/zoomin_rest.png',
|
||||||
|
GROUP: '/images/zoomin_grouphover.png',
|
||||||
|
HOVER: '/images/zoomin_hover.png',
|
||||||
|
DOWN: '/images/zoomin_pressed.png'
|
||||||
|
},
|
||||||
|
zoomOut: {
|
||||||
|
REST: '/images/zoomout_rest.png',
|
||||||
|
GROUP: '/images/zoomout_grouphover.png',
|
||||||
|
HOVER: '/images/zoomout_hover.png',
|
||||||
|
DOWN: '/images/zoomout_pressed.png'
|
||||||
|
},
|
||||||
|
home: {
|
||||||
|
REST: '/images/home_rest.png',
|
||||||
|
GROUP: '/images/home_grouphover.png',
|
||||||
|
HOVER: '/images/home_hover.png',
|
||||||
|
DOWN: '/images/home_pressed.png'
|
||||||
|
},
|
||||||
|
fullpage: {
|
||||||
|
REST: '/images/fullpage_rest.png',
|
||||||
|
GROUP: '/images/fullpage_grouphover.png',
|
||||||
|
HOVER: '/images/fullpage_hover.png',
|
||||||
|
DOWN: '/images/fullpage_pressed.png'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// See test/unit/core.js for details concerning isFunction.
|
// See test/unit/core.js for details concerning isFunction.
|
||||||
// Since version 1.3, DOM methods and functions like alert
|
// Since version 1.3, DOM methods and functions like alert
|
||||||
// aren't supported. They return false on IE (#2968).
|
// aren't supported. They return false on IE (#2968).
|
||||||
@ -2445,7 +2497,7 @@ $.Viewer = function( options ) {
|
|||||||
|
|
||||||
$.EventHandler.call( this );
|
$.EventHandler.call( this );
|
||||||
|
|
||||||
if( typeof( options ) != 'object' ){
|
if( !$.isPlainObject( options ) ){
|
||||||
options = {
|
options = {
|
||||||
id: args[ 0 ],
|
id: args[ 0 ],
|
||||||
xmlPath: args.length > 1 ? args[ 1 ] : undefined,
|
xmlPath: args.length > 1 ? args[ 1 ] : undefined,
|
||||||
@ -2462,60 +2514,11 @@ $.Viewer = function( options ) {
|
|||||||
id: options.id,
|
id: options.id,
|
||||||
xmlPath: null,
|
xmlPath: null,
|
||||||
tileSources: null,
|
tileSources: null,
|
||||||
prefixUrl: '',
|
prefixUrl: null,
|
||||||
controls: [],
|
controls: [],
|
||||||
overlays: [],
|
overlays: [],
|
||||||
overlayControls: [],
|
overlayControls: [],
|
||||||
config: {
|
config: $.DEFAULT_SETTINGS,
|
||||||
debugMode: true,
|
|
||||||
animationTime: 1.5,
|
|
||||||
blendTime: 0.5,
|
|
||||||
alwaysBlend: false,
|
|
||||||
autoHideControls: true,
|
|
||||||
immediateRender: false,
|
|
||||||
wrapHorizontal: false,
|
|
||||||
wrapVertical: false,
|
|
||||||
minZoomImageRatio: 0.8,
|
|
||||||
maxZoomPixelRatio: 2,
|
|
||||||
visibilityRatio: 0.5,
|
|
||||||
springStiffness: 5.0,
|
|
||||||
imageLoaderLimit: 0,
|
|
||||||
clickTimeThreshold: 200,
|
|
||||||
clickDistThreshold: 5,
|
|
||||||
zoomPerClick: 2.0,
|
|
||||||
zoomPerScroll: 1.2,
|
|
||||||
zoomPerSecond: 2.0,
|
|
||||||
showNavigationControl: true,
|
|
||||||
maxImageCacheCount: 100,
|
|
||||||
minPixelRatio: 0.5,
|
|
||||||
mouseNavEnabled: true,
|
|
||||||
navImages: {
|
|
||||||
zoomIn: {
|
|
||||||
REST: '/images/zoomin_rest.png',
|
|
||||||
GROUP: '/images/zoomin_grouphover.png',
|
|
||||||
HOVER: '/images/zoomin_hover.png',
|
|
||||||
DOWN: '/images/zoomin_pressed.png'
|
|
||||||
},
|
|
||||||
zoomOut: {
|
|
||||||
REST: '/images/zoomout_rest.png',
|
|
||||||
GROUP: '/images/zoomout_grouphover.png',
|
|
||||||
HOVER: '/images/zoomout_hover.png',
|
|
||||||
DOWN: '/images/zoomout_pressed.png'
|
|
||||||
},
|
|
||||||
home: {
|
|
||||||
REST: '/images/home_rest.png',
|
|
||||||
GROUP: '/images/home_grouphover.png',
|
|
||||||
HOVER: '/images/home_hover.png',
|
|
||||||
DOWN: '/images/home_pressed.png'
|
|
||||||
},
|
|
||||||
fullpage: {
|
|
||||||
REST: '/images/fullpage_rest.png',
|
|
||||||
GROUP: '/images/fullpage_grouphover.png',
|
|
||||||
HOVER: '/images/fullpage_hover.png',
|
|
||||||
DOWN: '/images/fullpage_pressed.png'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
//These were referenced but never defined
|
//These were referenced but never defined
|
||||||
controlsFadeDelay: 2000,
|
controlsFadeDelay: 2000,
|
||||||
@ -2643,12 +2646,13 @@ $.Viewer = function( options ) {
|
|||||||
onFullPageHandler = $.delegate( this, onFullPage ),
|
onFullPageHandler = $.delegate( this, onFullPage ),
|
||||||
navImages = this.config.navImages,
|
navImages = this.config.navImages,
|
||||||
zoomIn = new $.Button({
|
zoomIn = new $.Button({
|
||||||
config: this.config,
|
clickTimeThreshold: this.config.clickTimeThreshold,
|
||||||
|
clickDistThreshold: this.config.clickDistThreshold,
|
||||||
tooltip: $.getString( "Tooltips.ZoomIn" ),
|
tooltip: $.getString( "Tooltips.ZoomIn" ),
|
||||||
srcRest: resolveUrl( this.urlPrefix, navImages.zoomIn.REST ),
|
srcRest: resolveUrl( this.config.prefixUrl, navImages.zoomIn.REST ),
|
||||||
srcGroup: resolveUrl( this.urlPrefix, navImages.zoomIn.GROUP ),
|
srcGroup: resolveUrl( this.config.prefixUrl, navImages.zoomIn.GROUP ),
|
||||||
srcHover: resolveUrl( this.urlPrefix, navImages.zoomIn.HOVER ),
|
srcHover: resolveUrl( this.config.prefixUrl, navImages.zoomIn.HOVER ),
|
||||||
srcDown: resolveUrl( this.urlPrefix, navImages.zoomIn.DOWN ),
|
srcDown: resolveUrl( this.config.prefixUrl, navImages.zoomIn.DOWN ),
|
||||||
onPress: beginZoomingInHandler,
|
onPress: beginZoomingInHandler,
|
||||||
onRelease: endZoomingHandler,
|
onRelease: endZoomingHandler,
|
||||||
onClick: doSingleZoomInHandler,
|
onClick: doSingleZoomInHandler,
|
||||||
@ -2656,12 +2660,13 @@ $.Viewer = function( options ) {
|
|||||||
onExit: endZoomingHandler
|
onExit: endZoomingHandler
|
||||||
}),
|
}),
|
||||||
zoomOut = new $.Button({
|
zoomOut = new $.Button({
|
||||||
config: this.config,
|
clickTimeThreshold: this.config.clickTimeThreshold,
|
||||||
|
clickDistThreshold: this.config.clickDistThreshold,
|
||||||
tooltip: $.getString( "Tooltips.ZoomOut" ),
|
tooltip: $.getString( "Tooltips.ZoomOut" ),
|
||||||
srcRest: resolveUrl( this.urlPrefix, navImages.zoomOut.REST ),
|
srcRest: resolveUrl( this.config.prefixUrl, navImages.zoomOut.REST ),
|
||||||
srcGroup: resolveUrl( this.urlPrefix, navImages.zoomOut.GROUP ),
|
srcGroup: resolveUrl( this.config.prefixUrl, navImages.zoomOut.GROUP ),
|
||||||
srcHover: resolveUrl( this.urlPrefix, navImages.zoomOut.HOVER ),
|
srcHover: resolveUrl( this.config.prefixUrl, navImages.zoomOut.HOVER ),
|
||||||
srcDown: resolveUrl( this.urlPrefix, navImages.zoomOut.DOWN ),
|
srcDown: resolveUrl( this.config.prefixUrl, navImages.zoomOut.DOWN ),
|
||||||
onPress: beginZoomingOutHandler,
|
onPress: beginZoomingOutHandler,
|
||||||
onRelease: endZoomingHandler,
|
onRelease: endZoomingHandler,
|
||||||
onClick: doSingleZoomOutHandler,
|
onClick: doSingleZoomOutHandler,
|
||||||
@ -2669,21 +2674,23 @@ $.Viewer = function( options ) {
|
|||||||
onExit: endZoomingHandler
|
onExit: endZoomingHandler
|
||||||
}),
|
}),
|
||||||
goHome = new $.Button({
|
goHome = new $.Button({
|
||||||
config: this.config,
|
clickTimeThreshold: this.config.clickTimeThreshold,
|
||||||
|
clickDistThreshold: this.config.clickDistThreshold,
|
||||||
tooltip: $.getString( "Tooltips.Home" ),
|
tooltip: $.getString( "Tooltips.Home" ),
|
||||||
srcRest: resolveUrl( this.urlPrefix, navImages.home.REST ),
|
srcRest: resolveUrl( this.config.prefixUrl, navImages.home.REST ),
|
||||||
srcGroup: resolveUrl( this.urlPrefix, navImages.home.GROUP ),
|
srcGroup: resolveUrl( this.config.prefixUrl, navImages.home.GROUP ),
|
||||||
srcHover: resolveUrl( this.urlPrefix, navImages.home.HOVER ),
|
srcHover: resolveUrl( this.config.prefixUrl, navImages.home.HOVER ),
|
||||||
srcDown: resolveUrl( this.urlPrefix, navImages.home.DOWN ),
|
srcDown: resolveUrl( this.config.prefixUrl, navImages.home.DOWN ),
|
||||||
onRelease: onHomeHandler
|
onRelease: onHomeHandler
|
||||||
}),
|
}),
|
||||||
fullPage = new $.Button({
|
fullPage = new $.Button({
|
||||||
config: this.config,
|
clickTimeThreshold: this.config.clickTimeThreshold,
|
||||||
|
clickDistThreshold: this.config.clickDistThreshold,
|
||||||
tooltip: $.getString( "Tooltips.FullPage" ),
|
tooltip: $.getString( "Tooltips.FullPage" ),
|
||||||
srcRest: resolveUrl( this.urlPrefix, navImages.fullpage.REST ),
|
srcRest: resolveUrl( this.config.prefixUrl, navImages.fullpage.REST ),
|
||||||
srcGroup: resolveUrl( this.urlPrefix, navImages.fullpage.GROUP ),
|
srcGroup: resolveUrl( this.config.prefixUrl, navImages.fullpage.GROUP ),
|
||||||
srcHover: resolveUrl( this.urlPrefix, navImages.fullpage.HOVER ),
|
srcHover: resolveUrl( this.config.prefixUrl, navImages.fullpage.HOVER ),
|
||||||
srcDown: resolveUrl( this.urlPrefix, navImages.fullpage.DOWN ),
|
srcDown: resolveUrl( this.config.prefixUrl, navImages.fullpage.DOWN ),
|
||||||
onRelease: onFullPageHandler
|
onRelease: onFullPageHandler
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2882,11 +2889,13 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, {
|
|||||||
if( source ){
|
if( source ){
|
||||||
this.source = source;
|
this.source = source;
|
||||||
}
|
}
|
||||||
this.viewport = new $.Viewport(
|
|
||||||
THIS[ this.hash ].prevContainerSize,
|
this.viewport = new $.Viewport({
|
||||||
this.source.dimensions,
|
containerSize: THIS[ this.hash ].prevContainerSize,
|
||||||
this.config
|
contentSize: this.source.dimensions,
|
||||||
);
|
config: this.config
|
||||||
|
});
|
||||||
|
|
||||||
this.drawer = new $.Drawer(
|
this.drawer = new $.Drawer(
|
||||||
this.source,
|
this.source,
|
||||||
this.viewport,
|
this.viewport,
|
||||||
@ -4146,7 +4155,7 @@ $.ButtonState = {
|
|||||||
* @property {String} srcGroup URL of image to use in 'up' state
|
* @property {String} srcGroup URL of image to use in 'up' state
|
||||||
* @property {String} srcHover URL of image to use in 'hover' state
|
* @property {String} srcHover URL of image to use in 'hover' state
|
||||||
* @property {String} srcDown URL of image to use in 'domn' state
|
* @property {String} srcDown URL of image to use in 'domn' state
|
||||||
* @property {Object} config Configurable settings for this button.
|
* @property {Object} config Configurable settings for this button. DEPRECATED.
|
||||||
* @property {Element} [element] Element to use as a container for the
|
* @property {Element} [element] Element to use as a container for the
|
||||||
* button.
|
* button.
|
||||||
* @property {Number} fadeDelay How long to wait before fading
|
* @property {Number} fadeDelay How long to wait before fading
|
||||||
@ -4165,48 +4174,45 @@ $.Button = function( options ) {
|
|||||||
|
|
||||||
$.EventHandler.call( this );
|
$.EventHandler.call( this );
|
||||||
|
|
||||||
this.tooltip = options.tooltip;
|
$.extend( true, this, {
|
||||||
this.srcRest = options.srcRest;
|
|
||||||
this.srcGroup = options.srcGroup;
|
tooltip: null,
|
||||||
this.srcHover = options.srcHover;
|
srcRest: null,
|
||||||
this.srcDown = options.srcDown;
|
srcGroup: null,
|
||||||
|
srcHover: null,
|
||||||
|
srcDown: null,
|
||||||
|
clickTimeThreshold: $.DEFAULT_SETTINGS.clickTimeThreshold,
|
||||||
|
clickDistThreshold: $.DEFAULT_SETTINGS.clickDistThreshold,
|
||||||
|
// begin fading immediately
|
||||||
|
fadeDelay: 0,
|
||||||
|
// fade over a period of 2 seconds
|
||||||
|
fadeLength: 2000,
|
||||||
|
onPress: null,
|
||||||
|
onRelease: null,
|
||||||
|
onClick: null,
|
||||||
|
onEnter: null,
|
||||||
|
onExit: null
|
||||||
|
|
||||||
|
}, options );
|
||||||
|
|
||||||
//TODO: make button elements accessible by making them a-tags
|
//TODO: make button elements accessible by making them a-tags
|
||||||
// maybe even consider basing them on the element and adding
|
// maybe even consider basing them on the element and adding
|
||||||
// methods jquery-style.
|
// methods jquery-style.
|
||||||
this.element = options.element || $.makeNeutralElement( "a" );
|
this.element = options.element || $.makeNeutralElement( "a" );
|
||||||
this.element.href = '#';
|
this.element.href = '#';
|
||||||
this.config = options.config;
|
|
||||||
|
|
||||||
if ( options.onPress ){
|
this.addHandler( "onPress", this.onPress );
|
||||||
this.addHandler( "onPress", options.onPress );
|
this.addHandler( "onRelease", this.onRelease );
|
||||||
}
|
this.addHandler( "onClick", this.onClick );
|
||||||
if ( options.onRelease ){
|
this.addHandler( "onEnter", this.onEnter );
|
||||||
this.addHandler( "onRelease", options.onRelease );
|
this.addHandler( "onExit", this.onExit );
|
||||||
}
|
|
||||||
if ( options.onClick ){
|
|
||||||
this.addHandler( "onClick", options.onClick );
|
|
||||||
}
|
|
||||||
if ( options.onEnter ){
|
|
||||||
this.addHandler( "onEnter", options.onEnter );
|
|
||||||
}
|
|
||||||
if ( options.onExit ){
|
|
||||||
this.addHandler( "onExit", options.onExit );
|
|
||||||
}
|
|
||||||
|
|
||||||
this.currentState = $.ButtonState.GROUP;
|
this.currentState = $.ButtonState.GROUP;
|
||||||
this.tracker = new $.MouseTracker(
|
this.imgRest = $.makeTransparentImage( this.srcRest );
|
||||||
this.element,
|
this.imgGroup = $.makeTransparentImage( this.srcGroup );
|
||||||
this.config.clickTimeThreshold,
|
this.imgHover = $.makeTransparentImage( this.srcHover );
|
||||||
this.config.clickDistThreshold
|
this.imgDown = $.makeTransparentImage( this.srcDown );
|
||||||
);
|
|
||||||
this.imgRest = $.makeTransparentImage( this.config.prefixUrl + this.srcRest );
|
|
||||||
this.imgGroup = $.makeTransparentImage( this.config.prefixUrl + this.srcGroup );
|
|
||||||
this.imgHover = $.makeTransparentImage( this.config.prefixUrl + this.srcHover );
|
|
||||||
this.imgDown = $.makeTransparentImage( this.config.prefixUrl + this.srcDown );
|
|
||||||
|
|
||||||
this.fadeDelay = 0; // begin fading immediately
|
|
||||||
this.fadeLength = 2000; // fade over a period of 2 seconds
|
|
||||||
this.fadeBeginTime = null;
|
this.fadeBeginTime = null;
|
||||||
this.shouldFade = false;
|
this.shouldFade = false;
|
||||||
|
|
||||||
@ -4219,40 +4225,37 @@ $.Button = function( options ) {
|
|||||||
this.element.appendChild( this.imgHover );
|
this.element.appendChild( this.imgHover );
|
||||||
this.element.appendChild( this.imgDown );
|
this.element.appendChild( this.imgDown );
|
||||||
|
|
||||||
var styleRest = this.imgRest.style,
|
this.imgGroup.style.position =
|
||||||
styleGroup = this.imgGroup.style,
|
this.imgHover.style.position =
|
||||||
styleHover = this.imgHover.style,
|
this.imgDown.style.position =
|
||||||
styleDown = this.imgDown.style;
|
"absolute";
|
||||||
|
|
||||||
styleGroup.position =
|
this.imgGroup.style.top =
|
||||||
styleHover.position =
|
this.imgHover.style.top =
|
||||||
styleDown.position =
|
this.imgDown.style.top =
|
||||||
"absolute";
|
"0px";
|
||||||
|
|
||||||
styleGroup.top =
|
this.imgGroup.style.left =
|
||||||
styleHover.top =
|
this.imgHover.style.left =
|
||||||
styleDown.top =
|
this.imgDown.style.left =
|
||||||
"0px";
|
"0px";
|
||||||
|
|
||||||
styleGroup.left =
|
this.imgHover.style.visibility =
|
||||||
styleHover.left =
|
this.imgDown.style.visibility =
|
||||||
styleDown.left =
|
"hidden";
|
||||||
"0px";
|
|
||||||
|
|
||||||
styleHover.visibility =
|
if ( $.Browser.vendor == $.BROWSERS.FIREFOX && $.Browser.version < 3 ){
|
||||||
styleDown.visibility =
|
this.imgGroup.style.top =
|
||||||
"hidden";
|
this.imgHover.style.top =
|
||||||
|
this.imgDown.style.top =
|
||||||
if ( $.Browser.vendor == $.BROWSERS.FIREFOX
|
"";
|
||||||
&& $.Browser.version < 3 ){
|
|
||||||
|
|
||||||
styleGroup.top =
|
|
||||||
styleHover.top =
|
|
||||||
styleDown.top = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO - refactor mousetracer next to avoid this extension
|
this.tracker = new $.MouseTracker({
|
||||||
$.extend( this.tracker, {
|
|
||||||
|
element: this.element,
|
||||||
|
clickTimeThreshold: this.clickTimeThreshold,
|
||||||
|
clickDistThreshold: this.clickDistThreshold,
|
||||||
enterHandler: function( tracker, position, buttonDownElement, buttonDownAny ) {
|
enterHandler: function( tracker, position, buttonDownElement, buttonDownAny ) {
|
||||||
if ( buttonDownElement ) {
|
if ( buttonDownElement ) {
|
||||||
inTo( _this, $.ButtonState.DOWN );
|
inTo( _this, $.ButtonState.DOWN );
|
||||||
@ -4286,9 +4289,9 @@ $.Button = function( options ) {
|
|||||||
_this.raiseEvent("onClick", _this);
|
_this.raiseEvent("onClick", _this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
this.tracker.setTracking( true );
|
}).setTracking( true );
|
||||||
|
|
||||||
outTo( this, $.ButtonState.REST );
|
outTo( this, $.ButtonState.REST );
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -5995,7 +5998,6 @@ function drawTiles( drawer, lastDrawn ){
|
|||||||
*/
|
*/
|
||||||
$.Viewport = function( options ) {
|
$.Viewport = function( options ) {
|
||||||
|
|
||||||
var options;
|
|
||||||
|
|
||||||
if( arguments.length && arguments[ 0 ] instanceof $.Point ){
|
if( arguments.length && arguments[ 0 ] instanceof $.Point ){
|
||||||
options = {
|
options = {
|
||||||
@ -6003,8 +6005,6 @@ $.Viewport = function( options ) {
|
|||||||
contentSize: arguments[ 1 ],
|
contentSize: arguments[ 1 ],
|
||||||
config: arguments[ 2 ]
|
config: arguments[ 2 ]
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
options = arguments[ 0 ];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: this.config is something that should go away but currently the
|
//TODO: this.config is something that should go away but currently the
|
||||||
@ -6025,7 +6025,7 @@ $.Viewport = function( options ) {
|
|||||||
springStiffness: this.config.springStiffness,
|
springStiffness: this.config.springStiffness,
|
||||||
animationTime: this.config.animationTime
|
animationTime: this.config.animationTime
|
||||||
});
|
});
|
||||||
this.zoomSpring = new $.Spring({
|
this.zoomSpring = new $.Spring({
|
||||||
initial: 1,
|
initial: 1,
|
||||||
springStiffness: this.config.springStiffness,
|
springStiffness: this.config.springStiffness,
|
||||||
animationTime: this.config.animationTime
|
animationTime: this.config.animationTime
|
||||||
@ -6035,7 +6035,8 @@ $.Viewport = function( options ) {
|
|||||||
this.visibilityRatio = this.config.visibilityRatio;
|
this.visibilityRatio = this.config.visibilityRatio;
|
||||||
this.wrapHorizontal = this.config.wrapHorizontal;
|
this.wrapHorizontal = this.config.wrapHorizontal;
|
||||||
this.wrapVertical = this.config.wrapVertical;
|
this.wrapVertical = this.config.wrapVertical;
|
||||||
this.homeBounds = new $.Rect( 0, 0, 1, this.contentHeight );
|
this.homeBounds = new $.Rect( 0, 0, 1, this.contentHeight );
|
||||||
|
|
||||||
this.goHome( true );
|
this.goHome( true );
|
||||||
this.update();
|
this.update();
|
||||||
};
|
};
|
||||||
|
124
src/button.js
124
src/button.js
@ -34,7 +34,7 @@ $.ButtonState = {
|
|||||||
* @property {String} srcGroup URL of image to use in 'up' state
|
* @property {String} srcGroup URL of image to use in 'up' state
|
||||||
* @property {String} srcHover URL of image to use in 'hover' state
|
* @property {String} srcHover URL of image to use in 'hover' state
|
||||||
* @property {String} srcDown URL of image to use in 'domn' state
|
* @property {String} srcDown URL of image to use in 'domn' state
|
||||||
* @property {Object} config Configurable settings for this button.
|
* @property {Object} config Configurable settings for this button. DEPRECATED.
|
||||||
* @property {Element} [element] Element to use as a container for the
|
* @property {Element} [element] Element to use as a container for the
|
||||||
* button.
|
* button.
|
||||||
* @property {Number} fadeDelay How long to wait before fading
|
* @property {Number} fadeDelay How long to wait before fading
|
||||||
@ -53,48 +53,45 @@ $.Button = function( options ) {
|
|||||||
|
|
||||||
$.EventHandler.call( this );
|
$.EventHandler.call( this );
|
||||||
|
|
||||||
this.tooltip = options.tooltip;
|
$.extend( true, this, {
|
||||||
this.srcRest = options.srcRest;
|
|
||||||
this.srcGroup = options.srcGroup;
|
tooltip: null,
|
||||||
this.srcHover = options.srcHover;
|
srcRest: null,
|
||||||
this.srcDown = options.srcDown;
|
srcGroup: null,
|
||||||
|
srcHover: null,
|
||||||
|
srcDown: null,
|
||||||
|
clickTimeThreshold: $.DEFAULT_SETTINGS.clickTimeThreshold,
|
||||||
|
clickDistThreshold: $.DEFAULT_SETTINGS.clickDistThreshold,
|
||||||
|
// begin fading immediately
|
||||||
|
fadeDelay: 0,
|
||||||
|
// fade over a period of 2 seconds
|
||||||
|
fadeLength: 2000,
|
||||||
|
onPress: null,
|
||||||
|
onRelease: null,
|
||||||
|
onClick: null,
|
||||||
|
onEnter: null,
|
||||||
|
onExit: null
|
||||||
|
|
||||||
|
}, options );
|
||||||
|
|
||||||
//TODO: make button elements accessible by making them a-tags
|
//TODO: make button elements accessible by making them a-tags
|
||||||
// maybe even consider basing them on the element and adding
|
// maybe even consider basing them on the element and adding
|
||||||
// methods jquery-style.
|
// methods jquery-style.
|
||||||
this.element = options.element || $.makeNeutralElement( "a" );
|
this.element = options.element || $.makeNeutralElement( "a" );
|
||||||
this.element.href = '#';
|
this.element.href = '#';
|
||||||
this.config = options.config;
|
|
||||||
|
|
||||||
if ( options.onPress ){
|
this.addHandler( "onPress", this.onPress );
|
||||||
this.addHandler( "onPress", options.onPress );
|
this.addHandler( "onRelease", this.onRelease );
|
||||||
}
|
this.addHandler( "onClick", this.onClick );
|
||||||
if ( options.onRelease ){
|
this.addHandler( "onEnter", this.onEnter );
|
||||||
this.addHandler( "onRelease", options.onRelease );
|
this.addHandler( "onExit", this.onExit );
|
||||||
}
|
|
||||||
if ( options.onClick ){
|
|
||||||
this.addHandler( "onClick", options.onClick );
|
|
||||||
}
|
|
||||||
if ( options.onEnter ){
|
|
||||||
this.addHandler( "onEnter", options.onEnter );
|
|
||||||
}
|
|
||||||
if ( options.onExit ){
|
|
||||||
this.addHandler( "onExit", options.onExit );
|
|
||||||
}
|
|
||||||
|
|
||||||
this.currentState = $.ButtonState.GROUP;
|
this.currentState = $.ButtonState.GROUP;
|
||||||
this.tracker = new $.MouseTracker(
|
this.imgRest = $.makeTransparentImage( this.srcRest );
|
||||||
this.element,
|
this.imgGroup = $.makeTransparentImage( this.srcGroup );
|
||||||
this.config.clickTimeThreshold,
|
this.imgHover = $.makeTransparentImage( this.srcHover );
|
||||||
this.config.clickDistThreshold
|
this.imgDown = $.makeTransparentImage( this.srcDown );
|
||||||
);
|
|
||||||
this.imgRest = $.makeTransparentImage( this.config.prefixUrl + this.srcRest );
|
|
||||||
this.imgGroup = $.makeTransparentImage( this.config.prefixUrl + this.srcGroup );
|
|
||||||
this.imgHover = $.makeTransparentImage( this.config.prefixUrl + this.srcHover );
|
|
||||||
this.imgDown = $.makeTransparentImage( this.config.prefixUrl + this.srcDown );
|
|
||||||
|
|
||||||
this.fadeDelay = 0; // begin fading immediately
|
|
||||||
this.fadeLength = 2000; // fade over a period of 2 seconds
|
|
||||||
this.fadeBeginTime = null;
|
this.fadeBeginTime = null;
|
||||||
this.shouldFade = false;
|
this.shouldFade = false;
|
||||||
|
|
||||||
@ -107,40 +104,37 @@ $.Button = function( options ) {
|
|||||||
this.element.appendChild( this.imgHover );
|
this.element.appendChild( this.imgHover );
|
||||||
this.element.appendChild( this.imgDown );
|
this.element.appendChild( this.imgDown );
|
||||||
|
|
||||||
var styleRest = this.imgRest.style,
|
this.imgGroup.style.position =
|
||||||
styleGroup = this.imgGroup.style,
|
this.imgHover.style.position =
|
||||||
styleHover = this.imgHover.style,
|
this.imgDown.style.position =
|
||||||
styleDown = this.imgDown.style;
|
"absolute";
|
||||||
|
|
||||||
styleGroup.position =
|
this.imgGroup.style.top =
|
||||||
styleHover.position =
|
this.imgHover.style.top =
|
||||||
styleDown.position =
|
this.imgDown.style.top =
|
||||||
"absolute";
|
"0px";
|
||||||
|
|
||||||
styleGroup.top =
|
this.imgGroup.style.left =
|
||||||
styleHover.top =
|
this.imgHover.style.left =
|
||||||
styleDown.top =
|
this.imgDown.style.left =
|
||||||
"0px";
|
"0px";
|
||||||
|
|
||||||
styleGroup.left =
|
this.imgHover.style.visibility =
|
||||||
styleHover.left =
|
this.imgDown.style.visibility =
|
||||||
styleDown.left =
|
"hidden";
|
||||||
"0px";
|
|
||||||
|
|
||||||
styleHover.visibility =
|
if ( $.Browser.vendor == $.BROWSERS.FIREFOX && $.Browser.version < 3 ){
|
||||||
styleDown.visibility =
|
this.imgGroup.style.top =
|
||||||
"hidden";
|
this.imgHover.style.top =
|
||||||
|
this.imgDown.style.top =
|
||||||
if ( $.Browser.vendor == $.BROWSERS.FIREFOX
|
"";
|
||||||
&& $.Browser.version < 3 ){
|
|
||||||
|
|
||||||
styleGroup.top =
|
|
||||||
styleHover.top =
|
|
||||||
styleDown.top = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO - refactor mousetracer next to avoid this extension
|
this.tracker = new $.MouseTracker({
|
||||||
$.extend( this.tracker, {
|
|
||||||
|
element: this.element,
|
||||||
|
clickTimeThreshold: this.clickTimeThreshold,
|
||||||
|
clickDistThreshold: this.clickDistThreshold,
|
||||||
enterHandler: function( tracker, position, buttonDownElement, buttonDownAny ) {
|
enterHandler: function( tracker, position, buttonDownElement, buttonDownAny ) {
|
||||||
if ( buttonDownElement ) {
|
if ( buttonDownElement ) {
|
||||||
inTo( _this, $.ButtonState.DOWN );
|
inTo( _this, $.ButtonState.DOWN );
|
||||||
@ -174,9 +168,9 @@ $.Button = function( options ) {
|
|||||||
_this.raiseEvent("onClick", _this);
|
_this.raiseEvent("onClick", _this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
this.tracker.setTracking( true );
|
}).setTracking( true );
|
||||||
|
|
||||||
outTo( this, $.ButtonState.REST );
|
outTo( this, $.ButtonState.REST );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -90,6 +90,58 @@ OpenSeadragon = window.OpenSeadragon || (function(){
|
|||||||
indexOf = Array.prototype.indexOf;
|
indexOf = Array.prototype.indexOf;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
|
DEFAULT_SETTINGS: {
|
||||||
|
debugMode: true,
|
||||||
|
animationTime: 1.5,
|
||||||
|
blendTime: 0.5,
|
||||||
|
alwaysBlend: false,
|
||||||
|
autoHideControls: true,
|
||||||
|
immediateRender: false,
|
||||||
|
wrapHorizontal: false,
|
||||||
|
wrapVertical: false,
|
||||||
|
minZoomImageRatio: 0.8,
|
||||||
|
maxZoomPixelRatio: 2,
|
||||||
|
visibilityRatio: 0.5,
|
||||||
|
springStiffness: 5.0,
|
||||||
|
imageLoaderLimit: 0,
|
||||||
|
clickTimeThreshold: 200,
|
||||||
|
clickDistThreshold: 5,
|
||||||
|
zoomPerClick: 2.0,
|
||||||
|
zoomPerScroll: 1.2,
|
||||||
|
zoomPerSecond: 2.0,
|
||||||
|
showNavigationControl: true,
|
||||||
|
maxImageCacheCount: 100,
|
||||||
|
minPixelRatio: 0.5,
|
||||||
|
mouseNavEnabled: true,
|
||||||
|
navImages: {
|
||||||
|
zoomIn: {
|
||||||
|
REST: '/images/zoomin_rest.png',
|
||||||
|
GROUP: '/images/zoomin_grouphover.png',
|
||||||
|
HOVER: '/images/zoomin_hover.png',
|
||||||
|
DOWN: '/images/zoomin_pressed.png'
|
||||||
|
},
|
||||||
|
zoomOut: {
|
||||||
|
REST: '/images/zoomout_rest.png',
|
||||||
|
GROUP: '/images/zoomout_grouphover.png',
|
||||||
|
HOVER: '/images/zoomout_hover.png',
|
||||||
|
DOWN: '/images/zoomout_pressed.png'
|
||||||
|
},
|
||||||
|
home: {
|
||||||
|
REST: '/images/home_rest.png',
|
||||||
|
GROUP: '/images/home_grouphover.png',
|
||||||
|
HOVER: '/images/home_hover.png',
|
||||||
|
DOWN: '/images/home_pressed.png'
|
||||||
|
},
|
||||||
|
fullpage: {
|
||||||
|
REST: '/images/fullpage_rest.png',
|
||||||
|
GROUP: '/images/fullpage_grouphover.png',
|
||||||
|
HOVER: '/images/fullpage_hover.png',
|
||||||
|
DOWN: '/images/fullpage_pressed.png'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// See test/unit/core.js for details concerning isFunction.
|
// See test/unit/core.js for details concerning isFunction.
|
||||||
// Since version 1.3, DOM methods and functions like alert
|
// Since version 1.3, DOM methods and functions like alert
|
||||||
// aren't supported. They return false on IE (#2968).
|
// aren't supported. They return false on IE (#2968).
|
||||||
|
111
src/viewer.js
111
src/viewer.js
@ -35,7 +35,7 @@ $.Viewer = function( options ) {
|
|||||||
|
|
||||||
$.EventHandler.call( this );
|
$.EventHandler.call( this );
|
||||||
|
|
||||||
if( typeof( options ) != 'object' ){
|
if( !$.isPlainObject( options ) ){
|
||||||
options = {
|
options = {
|
||||||
id: args[ 0 ],
|
id: args[ 0 ],
|
||||||
xmlPath: args.length > 1 ? args[ 1 ] : undefined,
|
xmlPath: args.length > 1 ? args[ 1 ] : undefined,
|
||||||
@ -52,60 +52,11 @@ $.Viewer = function( options ) {
|
|||||||
id: options.id,
|
id: options.id,
|
||||||
xmlPath: null,
|
xmlPath: null,
|
||||||
tileSources: null,
|
tileSources: null,
|
||||||
prefixUrl: '',
|
prefixUrl: null,
|
||||||
controls: [],
|
controls: [],
|
||||||
overlays: [],
|
overlays: [],
|
||||||
overlayControls: [],
|
overlayControls: [],
|
||||||
config: {
|
config: $.DEFAULT_SETTINGS,
|
||||||
debugMode: true,
|
|
||||||
animationTime: 1.5,
|
|
||||||
blendTime: 0.5,
|
|
||||||
alwaysBlend: false,
|
|
||||||
autoHideControls: true,
|
|
||||||
immediateRender: false,
|
|
||||||
wrapHorizontal: false,
|
|
||||||
wrapVertical: false,
|
|
||||||
minZoomImageRatio: 0.8,
|
|
||||||
maxZoomPixelRatio: 2,
|
|
||||||
visibilityRatio: 0.5,
|
|
||||||
springStiffness: 5.0,
|
|
||||||
imageLoaderLimit: 0,
|
|
||||||
clickTimeThreshold: 200,
|
|
||||||
clickDistThreshold: 5,
|
|
||||||
zoomPerClick: 2.0,
|
|
||||||
zoomPerScroll: 1.2,
|
|
||||||
zoomPerSecond: 2.0,
|
|
||||||
showNavigationControl: true,
|
|
||||||
maxImageCacheCount: 100,
|
|
||||||
minPixelRatio: 0.5,
|
|
||||||
mouseNavEnabled: true,
|
|
||||||
navImages: {
|
|
||||||
zoomIn: {
|
|
||||||
REST: '/images/zoomin_rest.png',
|
|
||||||
GROUP: '/images/zoomin_grouphover.png',
|
|
||||||
HOVER: '/images/zoomin_hover.png',
|
|
||||||
DOWN: '/images/zoomin_pressed.png'
|
|
||||||
},
|
|
||||||
zoomOut: {
|
|
||||||
REST: '/images/zoomout_rest.png',
|
|
||||||
GROUP: '/images/zoomout_grouphover.png',
|
|
||||||
HOVER: '/images/zoomout_hover.png',
|
|
||||||
DOWN: '/images/zoomout_pressed.png'
|
|
||||||
},
|
|
||||||
home: {
|
|
||||||
REST: '/images/home_rest.png',
|
|
||||||
GROUP: '/images/home_grouphover.png',
|
|
||||||
HOVER: '/images/home_hover.png',
|
|
||||||
DOWN: '/images/home_pressed.png'
|
|
||||||
},
|
|
||||||
fullpage: {
|
|
||||||
REST: '/images/fullpage_rest.png',
|
|
||||||
GROUP: '/images/fullpage_grouphover.png',
|
|
||||||
HOVER: '/images/fullpage_hover.png',
|
|
||||||
DOWN: '/images/fullpage_pressed.png'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
//These were referenced but never defined
|
//These were referenced but never defined
|
||||||
controlsFadeDelay: 2000,
|
controlsFadeDelay: 2000,
|
||||||
@ -233,12 +184,13 @@ $.Viewer = function( options ) {
|
|||||||
onFullPageHandler = $.delegate( this, onFullPage ),
|
onFullPageHandler = $.delegate( this, onFullPage ),
|
||||||
navImages = this.config.navImages,
|
navImages = this.config.navImages,
|
||||||
zoomIn = new $.Button({
|
zoomIn = new $.Button({
|
||||||
config: this.config,
|
clickTimeThreshold: this.config.clickTimeThreshold,
|
||||||
|
clickDistThreshold: this.config.clickDistThreshold,
|
||||||
tooltip: $.getString( "Tooltips.ZoomIn" ),
|
tooltip: $.getString( "Tooltips.ZoomIn" ),
|
||||||
srcRest: resolveUrl( this.urlPrefix, navImages.zoomIn.REST ),
|
srcRest: resolveUrl( this.config.prefixUrl, navImages.zoomIn.REST ),
|
||||||
srcGroup: resolveUrl( this.urlPrefix, navImages.zoomIn.GROUP ),
|
srcGroup: resolveUrl( this.config.prefixUrl, navImages.zoomIn.GROUP ),
|
||||||
srcHover: resolveUrl( this.urlPrefix, navImages.zoomIn.HOVER ),
|
srcHover: resolveUrl( this.config.prefixUrl, navImages.zoomIn.HOVER ),
|
||||||
srcDown: resolveUrl( this.urlPrefix, navImages.zoomIn.DOWN ),
|
srcDown: resolveUrl( this.config.prefixUrl, navImages.zoomIn.DOWN ),
|
||||||
onPress: beginZoomingInHandler,
|
onPress: beginZoomingInHandler,
|
||||||
onRelease: endZoomingHandler,
|
onRelease: endZoomingHandler,
|
||||||
onClick: doSingleZoomInHandler,
|
onClick: doSingleZoomInHandler,
|
||||||
@ -246,12 +198,13 @@ $.Viewer = function( options ) {
|
|||||||
onExit: endZoomingHandler
|
onExit: endZoomingHandler
|
||||||
}),
|
}),
|
||||||
zoomOut = new $.Button({
|
zoomOut = new $.Button({
|
||||||
config: this.config,
|
clickTimeThreshold: this.config.clickTimeThreshold,
|
||||||
|
clickDistThreshold: this.config.clickDistThreshold,
|
||||||
tooltip: $.getString( "Tooltips.ZoomOut" ),
|
tooltip: $.getString( "Tooltips.ZoomOut" ),
|
||||||
srcRest: resolveUrl( this.urlPrefix, navImages.zoomOut.REST ),
|
srcRest: resolveUrl( this.config.prefixUrl, navImages.zoomOut.REST ),
|
||||||
srcGroup: resolveUrl( this.urlPrefix, navImages.zoomOut.GROUP ),
|
srcGroup: resolveUrl( this.config.prefixUrl, navImages.zoomOut.GROUP ),
|
||||||
srcHover: resolveUrl( this.urlPrefix, navImages.zoomOut.HOVER ),
|
srcHover: resolveUrl( this.config.prefixUrl, navImages.zoomOut.HOVER ),
|
||||||
srcDown: resolveUrl( this.urlPrefix, navImages.zoomOut.DOWN ),
|
srcDown: resolveUrl( this.config.prefixUrl, navImages.zoomOut.DOWN ),
|
||||||
onPress: beginZoomingOutHandler,
|
onPress: beginZoomingOutHandler,
|
||||||
onRelease: endZoomingHandler,
|
onRelease: endZoomingHandler,
|
||||||
onClick: doSingleZoomOutHandler,
|
onClick: doSingleZoomOutHandler,
|
||||||
@ -259,21 +212,23 @@ $.Viewer = function( options ) {
|
|||||||
onExit: endZoomingHandler
|
onExit: endZoomingHandler
|
||||||
}),
|
}),
|
||||||
goHome = new $.Button({
|
goHome = new $.Button({
|
||||||
config: this.config,
|
clickTimeThreshold: this.config.clickTimeThreshold,
|
||||||
|
clickDistThreshold: this.config.clickDistThreshold,
|
||||||
tooltip: $.getString( "Tooltips.Home" ),
|
tooltip: $.getString( "Tooltips.Home" ),
|
||||||
srcRest: resolveUrl( this.urlPrefix, navImages.home.REST ),
|
srcRest: resolveUrl( this.config.prefixUrl, navImages.home.REST ),
|
||||||
srcGroup: resolveUrl( this.urlPrefix, navImages.home.GROUP ),
|
srcGroup: resolveUrl( this.config.prefixUrl, navImages.home.GROUP ),
|
||||||
srcHover: resolveUrl( this.urlPrefix, navImages.home.HOVER ),
|
srcHover: resolveUrl( this.config.prefixUrl, navImages.home.HOVER ),
|
||||||
srcDown: resolveUrl( this.urlPrefix, navImages.home.DOWN ),
|
srcDown: resolveUrl( this.config.prefixUrl, navImages.home.DOWN ),
|
||||||
onRelease: onHomeHandler
|
onRelease: onHomeHandler
|
||||||
}),
|
}),
|
||||||
fullPage = new $.Button({
|
fullPage = new $.Button({
|
||||||
config: this.config,
|
clickTimeThreshold: this.config.clickTimeThreshold,
|
||||||
|
clickDistThreshold: this.config.clickDistThreshold,
|
||||||
tooltip: $.getString( "Tooltips.FullPage" ),
|
tooltip: $.getString( "Tooltips.FullPage" ),
|
||||||
srcRest: resolveUrl( this.urlPrefix, navImages.fullpage.REST ),
|
srcRest: resolveUrl( this.config.prefixUrl, navImages.fullpage.REST ),
|
||||||
srcGroup: resolveUrl( this.urlPrefix, navImages.fullpage.GROUP ),
|
srcGroup: resolveUrl( this.config.prefixUrl, navImages.fullpage.GROUP ),
|
||||||
srcHover: resolveUrl( this.urlPrefix, navImages.fullpage.HOVER ),
|
srcHover: resolveUrl( this.config.prefixUrl, navImages.fullpage.HOVER ),
|
||||||
srcDown: resolveUrl( this.urlPrefix, navImages.fullpage.DOWN ),
|
srcDown: resolveUrl( this.config.prefixUrl, navImages.fullpage.DOWN ),
|
||||||
onRelease: onFullPageHandler
|
onRelease: onFullPageHandler
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -472,11 +427,13 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, {
|
|||||||
if( source ){
|
if( source ){
|
||||||
this.source = source;
|
this.source = source;
|
||||||
}
|
}
|
||||||
this.viewport = new $.Viewport(
|
|
||||||
THIS[ this.hash ].prevContainerSize,
|
this.viewport = new $.Viewport({
|
||||||
this.source.dimensions,
|
containerSize: THIS[ this.hash ].prevContainerSize,
|
||||||
this.config
|
contentSize: this.source.dimensions,
|
||||||
);
|
config: this.config
|
||||||
|
});
|
||||||
|
|
||||||
this.drawer = new $.Drawer(
|
this.drawer = new $.Drawer(
|
||||||
this.source,
|
this.source,
|
||||||
this.viewport,
|
this.viewport,
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
*/
|
*/
|
||||||
$.Viewport = function( options ) {
|
$.Viewport = function( options ) {
|
||||||
|
|
||||||
var options;
|
|
||||||
|
|
||||||
if( arguments.length && arguments[ 0 ] instanceof $.Point ){
|
if( arguments.length && arguments[ 0 ] instanceof $.Point ){
|
||||||
options = {
|
options = {
|
||||||
@ -15,8 +14,6 @@ $.Viewport = function( options ) {
|
|||||||
contentSize: arguments[ 1 ],
|
contentSize: arguments[ 1 ],
|
||||||
config: arguments[ 2 ]
|
config: arguments[ 2 ]
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
options = arguments[ 0 ];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: this.config is something that should go away but currently the
|
//TODO: this.config is something that should go away but currently the
|
||||||
@ -37,7 +34,7 @@ $.Viewport = function( options ) {
|
|||||||
springStiffness: this.config.springStiffness,
|
springStiffness: this.config.springStiffness,
|
||||||
animationTime: this.config.animationTime
|
animationTime: this.config.animationTime
|
||||||
});
|
});
|
||||||
this.zoomSpring = new $.Spring({
|
this.zoomSpring = new $.Spring({
|
||||||
initial: 1,
|
initial: 1,
|
||||||
springStiffness: this.config.springStiffness,
|
springStiffness: this.config.springStiffness,
|
||||||
animationTime: this.config.animationTime
|
animationTime: this.config.animationTime
|
||||||
@ -47,7 +44,8 @@ $.Viewport = function( options ) {
|
|||||||
this.visibilityRatio = this.config.visibilityRatio;
|
this.visibilityRatio = this.config.visibilityRatio;
|
||||||
this.wrapHorizontal = this.config.wrapHorizontal;
|
this.wrapHorizontal = this.config.wrapHorizontal;
|
||||||
this.wrapVertical = this.config.wrapVertical;
|
this.wrapVertical = this.config.wrapVertical;
|
||||||
this.homeBounds = new $.Rect( 0, 0, 1, this.contentHeight );
|
this.homeBounds = new $.Rect( 0, 0, 1, this.contentHeight );
|
||||||
|
|
||||||
this.goHome( true );
|
this.goHome( true );
|
||||||
this.update();
|
this.update();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user