mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 14:46:10 +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 = {
|
$.EventHandler.prototype = {
|
||||||
|
|
||||||
addHandler: function(id, handler) {
|
addHandler: function( id, handler ) {
|
||||||
var events = this.events[ id ];
|
var events = this.events[ id ];
|
||||||
if( !events ){
|
if( !events ){
|
||||||
this.events[ id ] = 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
|
//Start Thatcher - unneccessary indirection. Also, because events were
|
||||||
// - not actually being removed, we need to add the code
|
// - not actually being removed, we need to add the code
|
||||||
// - to do the removal ourselves. TODO
|
// - to do the removal ourselves. TODO
|
||||||
var evt = this.events[ id ];
|
var events = this.events[ id ];
|
||||||
if (!evt) return;
|
if ( !events ){
|
||||||
|
return;
|
||||||
|
}
|
||||||
//End Thatcher
|
//End Thatcher
|
||||||
},
|
},
|
||||||
|
|
||||||
getHandler: function(id) {
|
getHandler: function( id ) {
|
||||||
var evt = this.events[ id ];
|
var events = this.events[ id ];
|
||||||
if (!evt || !evt.length) return null;
|
if ( !events || !events.length ){
|
||||||
evt = evt.length === 1 ?
|
return null;
|
||||||
[evt[0]] :
|
}
|
||||||
Array.apply( null, evt );
|
events = events.length === 1 ?
|
||||||
return function(source, args) {
|
[ events[ 0 ] ] :
|
||||||
for (var i = 0, l = evt.length; i < l; i++) {
|
Array.apply( null, events );
|
||||||
evt[i](source, args);
|
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 );
|
var handler = this.getHandler( eventName );
|
||||||
|
|
||||||
if (handler) {
|
if ( handler ) {
|
||||||
if (!eventArgs) {
|
if ( !eventArgs ) {
|
||||||
eventArgs = new Object();
|
eventArgs = new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
handler(this, eventArgs);
|
handler( this, eventArgs );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -2873,12 +2879,12 @@ $.Button = function( options ) {
|
|||||||
},
|
},
|
||||||
pressHandler: function(tracker, position) {
|
pressHandler: function(tracker, position) {
|
||||||
inTo( _this, $.ButtonState.DOWN );
|
inTo( _this, $.ButtonState.DOWN );
|
||||||
this.raiseEvent( "onPress", _this );
|
_this.raiseEvent( "onPress", _this );
|
||||||
},
|
},
|
||||||
releaseHandler: function(tracker, position, insideElmtPress, insideElmtRelease) {
|
releaseHandler: function(tracker, position, insideElmtPress, insideElmtRelease) {
|
||||||
if ( insideElmtPress && insideElmtRelease ) {
|
if ( insideElmtPress && insideElmtRelease ) {
|
||||||
outTo( _this, $.ButtonState.HOVER );
|
outTo( _this, $.ButtonState.HOVER );
|
||||||
this.raiseEvent( "onRelease", _this );
|
_this.raiseEvent( "onRelease", _this );
|
||||||
} else if ( insideElmtPress ) {
|
} else if ( insideElmtPress ) {
|
||||||
outTo( _this, $.ButtonState.GROUP );
|
outTo( _this, $.ButtonState.GROUP );
|
||||||
} else {
|
} else {
|
||||||
@ -2970,8 +2976,8 @@ function outTo( button, newState ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( newState <= $.ButtonState.GROUP && button.currentState == $.ButtonState.HOVER ) {
|
if ( newState <= $.ButtonState.GROUP && button.currentState == $.ButtonState.HOVER ) {
|
||||||
this.imgHover.style.visibility = "hidden";
|
button.imgHover.style.visibility = "hidden";
|
||||||
this.currentState = $.ButtonState.GROUP;
|
button.currentState = $.ButtonState.GROUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( button.newState <= $.ButtonState.REST && button.currentState == $.ButtonState.GROUP ) {
|
if ( button.newState <= $.ButtonState.REST && button.currentState == $.ButtonState.GROUP ) {
|
||||||
|
@ -116,12 +116,12 @@ $.Button = function( options ) {
|
|||||||
},
|
},
|
||||||
pressHandler: function(tracker, position) {
|
pressHandler: function(tracker, position) {
|
||||||
inTo( _this, $.ButtonState.DOWN );
|
inTo( _this, $.ButtonState.DOWN );
|
||||||
this.raiseEvent( "onPress", _this );
|
_this.raiseEvent( "onPress", _this );
|
||||||
},
|
},
|
||||||
releaseHandler: function(tracker, position, insideElmtPress, insideElmtRelease) {
|
releaseHandler: function(tracker, position, insideElmtPress, insideElmtRelease) {
|
||||||
if ( insideElmtPress && insideElmtRelease ) {
|
if ( insideElmtPress && insideElmtRelease ) {
|
||||||
outTo( _this, $.ButtonState.HOVER );
|
outTo( _this, $.ButtonState.HOVER );
|
||||||
this.raiseEvent( "onRelease", _this );
|
_this.raiseEvent( "onRelease", _this );
|
||||||
} else if ( insideElmtPress ) {
|
} else if ( insideElmtPress ) {
|
||||||
outTo( _this, $.ButtonState.GROUP );
|
outTo( _this, $.ButtonState.GROUP );
|
||||||
} else {
|
} else {
|
||||||
@ -213,8 +213,8 @@ function outTo( button, newState ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( newState <= $.ButtonState.GROUP && button.currentState == $.ButtonState.HOVER ) {
|
if ( newState <= $.ButtonState.GROUP && button.currentState == $.ButtonState.HOVER ) {
|
||||||
this.imgHover.style.visibility = "hidden";
|
button.imgHover.style.visibility = "hidden";
|
||||||
this.currentState = $.ButtonState.GROUP;
|
button.currentState = $.ButtonState.GROUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( button.newState <= $.ButtonState.REST && button.currentState == $.ButtonState.GROUP ) {
|
if ( button.newState <= $.ButtonState.REST && button.currentState == $.ButtonState.GROUP ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user