mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-29 08:36: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();
|
this._events = new $.EventHandlerList();
|
||||||
|
|
||||||
if ( options.onPress != undefined )
|
if ( options.onPress != undefined )
|
||||||
this.add_onPress( options.onPress );
|
this._events.addHandler("onPress", options.onPress );
|
||||||
if ( options.onRelease != undefined )
|
if ( options.onRelease != undefined )
|
||||||
this.add_onRelease( options.onRelease );
|
this._events.addHandler("onRelease", options.onRelease );
|
||||||
if ( options.onClick != undefined )
|
if ( options.onClick != undefined )
|
||||||
this.add_onClick( options.onClick );
|
this._events.addHandler("onClick", options.onClick );
|
||||||
if ( options.onEnter != undefined )
|
if ( options.onEnter != undefined )
|
||||||
this.add_onEnter( options.onEnter );
|
this._events.addHandler("onEnter", options.onEnter );
|
||||||
if ( options.onExit != undefined )
|
if ( options.onExit != undefined )
|
||||||
this.add_onExit( options.onExit );
|
this._events.addHandler("onExit", options.onExit );
|
||||||
|
|
||||||
this._button = $.Utils.makeNeutralElement("span");
|
this._button = $.Utils.makeNeutralElement("span");
|
||||||
this._currentState = $.ButtonState.GROUP;
|
this._currentState = $.ButtonState.GROUP;
|
||||||
@ -3025,36 +3025,6 @@ $.Button.prototype = {
|
|||||||
set_srcDown: function(value) {
|
set_srcDown: function(value) {
|
||||||
this._srcDown = 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() {
|
notifyGroupEnter: function() {
|
||||||
this._inTo($.ButtonState.GROUP);
|
this._inTo($.ButtonState.GROUP);
|
||||||
},
|
},
|
||||||
|
@ -21,15 +21,15 @@ $.Button = function( options ) {
|
|||||||
this._events = new $.EventHandlerList();
|
this._events = new $.EventHandlerList();
|
||||||
|
|
||||||
if ( options.onPress != undefined )
|
if ( options.onPress != undefined )
|
||||||
this.add_onPress( options.onPress );
|
this._events.addHandler("onPress", options.onPress );
|
||||||
if ( options.onRelease != undefined )
|
if ( options.onRelease != undefined )
|
||||||
this.add_onRelease( options.onRelease );
|
this._events.addHandler("onRelease", options.onRelease );
|
||||||
if ( options.onClick != undefined )
|
if ( options.onClick != undefined )
|
||||||
this.add_onClick( options.onClick );
|
this._events.addHandler("onClick", options.onClick );
|
||||||
if ( options.onEnter != undefined )
|
if ( options.onEnter != undefined )
|
||||||
this.add_onEnter( options.onEnter );
|
this._events.addHandler("onEnter", options.onEnter );
|
||||||
if ( options.onExit != undefined )
|
if ( options.onExit != undefined )
|
||||||
this.add_onExit( options.onExit );
|
this._events.addHandler("onExit", options.onExit );
|
||||||
|
|
||||||
this._button = $.Utils.makeNeutralElement("span");
|
this._button = $.Utils.makeNeutralElement("span");
|
||||||
this._currentState = $.ButtonState.GROUP;
|
this._currentState = $.ButtonState.GROUP;
|
||||||
@ -228,36 +228,6 @@ $.Button.prototype = {
|
|||||||
set_srcDown: function(value) {
|
set_srcDown: function(value) {
|
||||||
this._srcDown = 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() {
|
notifyGroupEnter: function() {
|
||||||
this._inTo($.ButtonState.GROUP);
|
this._inTo($.ButtonState.GROUP);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user