mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
found some lingering references to 'this' in private closure methods.
This commit is contained in:
parent
345e5f3e6c
commit
114a26b1a9
@ -210,45 +210,51 @@ OpenSeadragon = window.OpenSeadragon || (function(){
|
||||
|
||||
$.EventHandler.prototype = {
|
||||
|
||||
addHandler: function(id, handler) {
|
||||
addHandler: function( id, handler ) {
|
||||
var events = this.events[ id ];
|
||||
if( !events ){
|
||||
this.events[ id ] = events = [];
|
||||
}
|
||||
events[events.length] = handler;
|
||||
events[ events.length ] = handler;
|
||||
},
|
||||
|
||||
removeHandler: function(id, handler) {
|
||||
removeHandler: function( id, handler ) {
|
||||
//Start Thatcher - unneccessary indirection. Also, because events were
|
||||
// - not actually being removed, we need to add the code
|
||||
// - to do the removal ourselves. TODO
|
||||
var evt = this.events[ id ];
|
||||
if (!evt) return;
|
||||
var events = this.events[ id ];
|
||||
if ( !events ){
|
||||
return;
|
||||
}
|
||||
//End Thatcher
|
||||
},
|
||||
|
||||
getHandler: function(id) {
|
||||
var evt = this.events[ id ];
|
||||
if (!evt || !evt.length) return null;
|
||||
evt = evt.length === 1 ?
|
||||
[evt[0]] :
|
||||
Array.apply( null, evt );
|
||||
return function(source, args) {
|
||||
for (var i = 0, l = evt.length; i < l; i++) {
|
||||
evt[i](source, args);
|
||||
getHandler: function( id ) {
|
||||
var events = this.events[ id ];
|
||||
if ( !events || !events.length ){
|
||||
return null;
|
||||
}
|
||||
events = events.length === 1 ?
|
||||
[ events[ 0 ] ] :
|
||||
Array.apply( null, events );
|
||||
return function( source, args ) {
|
||||
var i,
|
||||
l = events.length;
|
||||
for ( i = 0; i < l; i++ ) {
|
||||
events[ i ]( source, args );
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
raiseEvent: function(eventName, eventArgs) {
|
||||
raiseEvent: function( eventName, eventArgs ) {
|
||||
var handler = this.getHandler( eventName );
|
||||
|
||||
if (handler) {
|
||||
if (!eventArgs) {
|
||||
if ( handler ) {
|
||||
if ( !eventArgs ) {
|
||||
eventArgs = new Object();
|
||||
}
|
||||
|
||||
handler(this, eventArgs);
|
||||
handler( this, eventArgs );
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -2873,12 +2879,12 @@ $.Button = function( options ) {
|
||||
},
|
||||
pressHandler: function(tracker, position) {
|
||||
inTo( _this, $.ButtonState.DOWN );
|
||||
this.raiseEvent( "onPress", _this );
|
||||
_this.raiseEvent( "onPress", _this );
|
||||
},
|
||||
releaseHandler: function(tracker, position, insideElmtPress, insideElmtRelease) {
|
||||
if ( insideElmtPress && insideElmtRelease ) {
|
||||
outTo( _this, $.ButtonState.HOVER );
|
||||
this.raiseEvent( "onRelease", _this );
|
||||
_this.raiseEvent( "onRelease", _this );
|
||||
} else if ( insideElmtPress ) {
|
||||
outTo( _this, $.ButtonState.GROUP );
|
||||
} else {
|
||||
@ -2970,8 +2976,8 @@ function outTo( button, newState ) {
|
||||
}
|
||||
|
||||
if ( newState <= $.ButtonState.GROUP && button.currentState == $.ButtonState.HOVER ) {
|
||||
this.imgHover.style.visibility = "hidden";
|
||||
this.currentState = $.ButtonState.GROUP;
|
||||
button.imgHover.style.visibility = "hidden";
|
||||
button.currentState = $.ButtonState.GROUP;
|
||||
}
|
||||
|
||||
if ( button.newState <= $.ButtonState.REST && button.currentState == $.ButtonState.GROUP ) {
|
||||
|
@ -116,12 +116,12 @@ $.Button = function( options ) {
|
||||
},
|
||||
pressHandler: function(tracker, position) {
|
||||
inTo( _this, $.ButtonState.DOWN );
|
||||
this.raiseEvent( "onPress", _this );
|
||||
_this.raiseEvent( "onPress", _this );
|
||||
},
|
||||
releaseHandler: function(tracker, position, insideElmtPress, insideElmtRelease) {
|
||||
if ( insideElmtPress && insideElmtRelease ) {
|
||||
outTo( _this, $.ButtonState.HOVER );
|
||||
this.raiseEvent( "onRelease", _this );
|
||||
_this.raiseEvent( "onRelease", _this );
|
||||
} else if ( insideElmtPress ) {
|
||||
outTo( _this, $.ButtonState.GROUP );
|
||||
} else {
|
||||
@ -213,8 +213,8 @@ function outTo( button, newState ) {
|
||||
}
|
||||
|
||||
if ( newState <= $.ButtonState.GROUP && button.currentState == $.ButtonState.HOVER ) {
|
||||
this.imgHover.style.visibility = "hidden";
|
||||
this.currentState = $.ButtonState.GROUP;
|
||||
button.imgHover.style.visibility = "hidden";
|
||||
button.currentState = $.ButtonState.GROUP;
|
||||
}
|
||||
|
||||
if ( button.newState <= $.ButtonState.REST && button.currentState == $.ButtonState.GROUP ) {
|
||||
|
Loading…
Reference in New Issue
Block a user