git-svn-id: http://svn.openlayers.org/trunk/openlayers@861 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-07-04 10:34:15 +00:00
parent 397b4cc7ba
commit 2bea4fed77
+22 -7
View File
@@ -1,10 +1,14 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full * See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */ * text of the license. */
OpenLayers.Events = Class.create();
/**
* @class
*/
OpenLayers.Events = Class.create();
OpenLayers.Events.prototype = { OpenLayers.Events.prototype = {
// Array: supported events
/** @final @type Array: supported events */
BROWSER_EVENTS: [ BROWSER_EVENTS: [
"mouseover", "mouseout", "mouseover", "mouseout",
"mousedown", "mouseup", "mousemove", "mousedown", "mouseup", "mousemove",
@@ -12,19 +16,21 @@ OpenLayers.Events.prototype = {
"resize", "focus", "blur" "resize", "focus", "blur"
], ],
// hash of Array(Function): events listener functions /** @type Hash of Array(Function): events listener functions */
listeners: null, listeners: null,
// Object: the code object issuing application events /** @type Object: the code object issuing application events */
object: null, object: null,
// DOMElement: the DOM element receiving browser events /** @type DOMElement: the DOM element receiving browser events */
div: null, div: null,
// Array: list of support application events /** @type Array: list of support application events */
eventTypes: null, eventTypes: null,
/** /**
* @constructor
*
* @param {OpenLayers.Map} map * @param {OpenLayers.Map} map
* @param {DOMElement} div * @param {DOMElement} div
*/ */
@@ -67,6 +73,11 @@ OpenLayers.Events.prototype = {
listeners.push( {obj: obj, func: func} ); listeners.push( {obj: obj, func: func} );
}, },
/**
* @param {str} type
* @param {Object} obj
* @param {Function} func
*/
unregister: function (type, obj, func) { unregister: function (type, obj, func) {
var listeners = this.listeners[type]; var listeners = this.listeners[type];
for (var i = 0; i < listeners.length; i++) { for (var i = 0; i < listeners.length; i++) {
@@ -77,6 +88,9 @@ OpenLayers.Events.prototype = {
} }
}, },
/**
* @param {str} type
*/
remove: function(type) { remove: function(type) {
this.listeners[type].pop(); this.listeners[type].pop();
}, },
@@ -92,7 +106,8 @@ OpenLayers.Events.prototype = {
/** /**
* @param {event} evt * @param {event} evt
* *
* @return {OpenLayers.Pixel} * @returns The current xy coordinate of the mouse, adjusted for offsets
* @type OpenLayers.Pixel
*/ */
getMousePosition: function (evt) { getMousePosition: function (evt) {
if (!this.div.offsets) { if (!this.div.offsets) {