mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-25 23:44:54 +01:00
Remove our custorm event handing on Web2D
This commit is contained in:
parent
dc50cee16d
commit
d94414775e
@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright [2011] [wisemapping]
|
|
||||||
*
|
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the license at
|
|
||||||
*
|
|
||||||
* http://www.wisemapping.org/license
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
web2d.EventDispatcher = function(element) {
|
|
||||||
this._listeners = [];
|
|
||||||
var dispatcher = this;
|
|
||||||
|
|
||||||
this.eventListener = function(event) {
|
|
||||||
for (var i = 0; i < dispatcher._listeners.length; i++) {
|
|
||||||
if (dispatcher._listeners[i] != null) {
|
|
||||||
dispatcher._listeners[i].call(element, new Event(event) || new Event(window.event));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
web2d.EventDispatcher.prototype.addListener = function(type, listener) {
|
|
||||||
if (!$defined(listener)) {
|
|
||||||
throw "Listener can not be null.";
|
|
||||||
}
|
|
||||||
this._listeners.include(listener);
|
|
||||||
};
|
|
||||||
|
|
||||||
web2d.EventDispatcher.prototype.removeListener = function(type, listener) {
|
|
||||||
if (!$defined(listener)) {
|
|
||||||
throw "Listener can not be null.";
|
|
||||||
}
|
|
||||||
|
|
||||||
// var found = false;
|
|
||||||
var length = this._listeners.length;
|
|
||||||
|
|
||||||
this._listeners.erase(listener);
|
|
||||||
|
|
||||||
var newLength = this._listeners.length;
|
|
||||||
|
|
||||||
if (newLength >= length) {
|
|
||||||
throw "There is not listener to remove";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
web2d.EventDispatcher.prototype.getListenersCount = function() {
|
|
||||||
return this._listeners.length;
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user