From 2bea4fed77139d0e800e34a1477ca97f0e68115f Mon Sep 17 00:00:00 2001 From: euzuro Date: Tue, 4 Jul 2006 10:34:15 +0000 Subject: [PATCH] jsdoc git-svn-id: http://svn.openlayers.org/trunk/openlayers@861 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Events.js | 59 +++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/lib/OpenLayers/Events.js b/lib/OpenLayers/Events.js index 00e158b4f9..781cf8cf11 100644 --- a/lib/OpenLayers/Events.js +++ b/lib/OpenLayers/Events.js @@ -1,10 +1,14 @@ /* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. * See http://svn.openlayers.org/trunk/openlayers/license.txt for the full * text of the license. */ + + /** + * @class + */ OpenLayers.Events = Class.create(); - OpenLayers.Events.prototype = { - // Array: supported events + + /** @final @type Array: supported events */ BROWSER_EVENTS: [ "mouseover", "mouseout", "mousedown", "mouseup", "mousemove", @@ -12,22 +16,24 @@ OpenLayers.Events.prototype = { "resize", "focus", "blur" ], - // hash of Array(Function): events listener functions + /** @type Hash of Array(Function): events listener functions */ listeners: null, - // Object: the code object issuing application events + /** @type Object: the code object issuing application events */ object: null, - // DOMElement: the DOM element receiving browser events + /** @type DOMElement: the DOM element receiving browser events */ div: null, - // Array: list of support application events + /** @type Array: list of support application events */ eventTypes: null, /** - * @param {OpenLayers.Map} map - * @param {DOMElement} div - */ + * @constructor + * + * @param {OpenLayers.Map} map + * @param {DOMElement} div + */ initialize: function (object, div, eventTypes) { this.listeners = {}; this.object = object; @@ -54,10 +60,10 @@ OpenLayers.Events.prototype = { }, /** - * @param {str} type - * @param {Object} obj - * @param {Function} func - */ + * @param {str} type + * @param {Object} obj + * @param {Function} func + */ register: function (type, obj, func) { if (func == null) { obj = this.object; @@ -67,6 +73,11 @@ OpenLayers.Events.prototype = { listeners.push( {obj: obj, func: func} ); }, + /** + * @param {str} type + * @param {Object} obj + * @param {Function} func + */ unregister: function (type, obj, func) { var listeners = this.listeners[type]; for (var i = 0; i < listeners.length; i++) { @@ -77,23 +88,27 @@ OpenLayers.Events.prototype = { } }, + /** + * @param {str} type + */ remove: function(type) { this.listeners[type].pop(); }, /** - * @param {event} evt - */ + * @param {event} evt + */ handleBrowserEvent: function (evt) { evt.xy = this.getMousePosition(evt); this.triggerEvent(evt.type, evt) }, /** - * @param {event} evt - * - * @return {OpenLayers.Pixel} - */ + * @param {event} evt + * + * @returns The current xy coordinate of the mouse, adjusted for offsets + * @type OpenLayers.Pixel + */ getMousePosition: function (evt) { if (!this.div.offsets) { this.div.offsets = Position.page(this.div); @@ -104,9 +119,9 @@ OpenLayers.Events.prototype = { }, /** - * @param {str} type - * @param {event} evt - */ + * @param {str} type + * @param {event} evt + */ triggerEvent: function (type, evt) { if (evt == null) { evt = {};