jsdoc
git-svn-id: http://svn.openlayers.org/trunk/openlayers@861 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -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 = {};
|
||||
|
||||
Reference in New Issue
Block a user