mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
remove add_foo remove_foo methods in favor of adding them directly via this._events.addHandler etc. made some notes on how to replace this._events in general by mixing-in EventHandlerList to the object prototype so this.addHandler can be used directly.
This commit is contained in:
parent
d7de748434
commit
01153bcb91
@ -2818,15 +2818,15 @@ $.Button = function( options ) {
|
||||
this._events = new $.EventHandlerList();
|
||||
|
||||
if ( options.onPress != undefined )
|
||||
this.add_onPress( options.onPress );
|
||||
this._events.addHandler("onPress", options.onPress );
|
||||
if ( options.onRelease != undefined )
|
||||
this.add_onRelease( options.onRelease );
|
||||
this._events.addHandler("onRelease", options.onRelease );
|
||||
if ( options.onClick != undefined )
|
||||
this.add_onClick( options.onClick );
|
||||
this._events.addHandler("onClick", options.onClick );
|
||||
if ( options.onEnter != undefined )
|
||||
this.add_onEnter( options.onEnter );
|
||||
this._events.addHandler("onEnter", options.onEnter );
|
||||
if ( options.onExit != undefined )
|
||||
this.add_onExit( options.onExit );
|
||||
this._events.addHandler("onExit", options.onExit );
|
||||
|
||||
this._button = $.Utils.makeNeutralElement("span");
|
||||
this._currentState = $.ButtonState.GROUP;
|
||||
@ -3025,36 +3025,6 @@ $.Button.prototype = {
|
||||
set_srcDown: function(value) {
|
||||
this._srcDown = value;
|
||||
},
|
||||
add_onPress: function(handler) {
|
||||
this.get_events().addHandler("onPress", handler);
|
||||
},
|
||||
remove_onPress: function(handler) {
|
||||
this.get_events().removeHandler("onPress", handler);
|
||||
},
|
||||
add_onClick: function(handler) {
|
||||
this.get_events().addHandler("onClick", handler);
|
||||
},
|
||||
remove_onClick: function(handler) {
|
||||
this.get_events().removeHandler("onClick", handler);
|
||||
},
|
||||
add_onEnter: function(handler) {
|
||||
this.get_events().addHandler("onEnter", handler);
|
||||
},
|
||||
remove_onEnter: function(handler) {
|
||||
this.get_events().removeHandler("onEnter", handler);
|
||||
},
|
||||
add_onRelease: function(handler) {
|
||||
this.get_events().addHandler("onRelease", handler);
|
||||
},
|
||||
remove_onRelease: function(handler) {
|
||||
this.get_events().removeHandler("onRelease", handler);
|
||||
},
|
||||
add_onExit: function(handler) {
|
||||
this.get_events().addHandler("onExit", handler);
|
||||
},
|
||||
remove_onExit: function(handler) {
|
||||
this.get_events().removeHandler("onExit", handler);
|
||||
},
|
||||
notifyGroupEnter: function() {
|
||||
this._inTo($.ButtonState.GROUP);
|
||||
},
|
||||
|
@ -21,15 +21,15 @@ $.Button = function( options ) {
|
||||
this._events = new $.EventHandlerList();
|
||||
|
||||
if ( options.onPress != undefined )
|
||||
this.add_onPress( options.onPress );
|
||||
this._events.addHandler("onPress", options.onPress );
|
||||
if ( options.onRelease != undefined )
|
||||
this.add_onRelease( options.onRelease );
|
||||
this._events.addHandler("onRelease", options.onRelease );
|
||||
if ( options.onClick != undefined )
|
||||
this.add_onClick( options.onClick );
|
||||
this._events.addHandler("onClick", options.onClick );
|
||||
if ( options.onEnter != undefined )
|
||||
this.add_onEnter( options.onEnter );
|
||||
this._events.addHandler("onEnter", options.onEnter );
|
||||
if ( options.onExit != undefined )
|
||||
this.add_onExit( options.onExit );
|
||||
this._events.addHandler("onExit", options.onExit );
|
||||
|
||||
this._button = $.Utils.makeNeutralElement("span");
|
||||
this._currentState = $.ButtonState.GROUP;
|
||||
@ -228,36 +228,6 @@ $.Button.prototype = {
|
||||
set_srcDown: function(value) {
|
||||
this._srcDown = value;
|
||||
},
|
||||
add_onPress: function(handler) {
|
||||
this.get_events().addHandler("onPress", handler);
|
||||
},
|
||||
remove_onPress: function(handler) {
|
||||
this.get_events().removeHandler("onPress", handler);
|
||||
},
|
||||
add_onClick: function(handler) {
|
||||
this.get_events().addHandler("onClick", handler);
|
||||
},
|
||||
remove_onClick: function(handler) {
|
||||
this.get_events().removeHandler("onClick", handler);
|
||||
},
|
||||
add_onEnter: function(handler) {
|
||||
this.get_events().addHandler("onEnter", handler);
|
||||
},
|
||||
remove_onEnter: function(handler) {
|
||||
this.get_events().removeHandler("onEnter", handler);
|
||||
},
|
||||
add_onRelease: function(handler) {
|
||||
this.get_events().addHandler("onRelease", handler);
|
||||
},
|
||||
remove_onRelease: function(handler) {
|
||||
this.get_events().removeHandler("onRelease", handler);
|
||||
},
|
||||
add_onExit: function(handler) {
|
||||
this.get_events().addHandler("onExit", handler);
|
||||
},
|
||||
remove_onExit: function(handler) {
|
||||
this.get_events().removeHandler("onExit", handler);
|
||||
},
|
||||
notifyGroupEnter: function() {
|
||||
this._inTo($.ButtonState.GROUP);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user