jsdoc
git-svn-id: http://svn.openlayers.org/trunk/openlayers@861 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
+37
-22
@@ -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. */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
OpenLayers.Events = Class.create();
|
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,22 +16,24 @@ 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,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {OpenLayers.Map} map
|
* @constructor
|
||||||
* @param {DOMElement} div
|
*
|
||||||
*/
|
* @param {OpenLayers.Map} map
|
||||||
|
* @param {DOMElement} div
|
||||||
|
*/
|
||||||
initialize: function (object, div, eventTypes) {
|
initialize: function (object, div, eventTypes) {
|
||||||
this.listeners = {};
|
this.listeners = {};
|
||||||
this.object = object;
|
this.object = object;
|
||||||
@@ -54,10 +60,10 @@ OpenLayers.Events.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {str} type
|
* @param {str} type
|
||||||
* @param {Object} obj
|
* @param {Object} obj
|
||||||
* @param {Function} func
|
* @param {Function} func
|
||||||
*/
|
*/
|
||||||
register: function (type, obj, func) {
|
register: function (type, obj, func) {
|
||||||
if (func == null) {
|
if (func == null) {
|
||||||
obj = this.object;
|
obj = this.object;
|
||||||
@@ -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,23 +88,27 @@ OpenLayers.Events.prototype = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {str} type
|
||||||
|
*/
|
||||||
remove: function(type) {
|
remove: function(type) {
|
||||||
this.listeners[type].pop();
|
this.listeners[type].pop();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {event} evt
|
* @param {event} evt
|
||||||
*/
|
*/
|
||||||
handleBrowserEvent: function (evt) {
|
handleBrowserEvent: function (evt) {
|
||||||
evt.xy = this.getMousePosition(evt);
|
evt.xy = this.getMousePosition(evt);
|
||||||
this.triggerEvent(evt.type, evt)
|
this.triggerEvent(evt.type, evt)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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) {
|
||||||
this.div.offsets = Position.page(this.div);
|
this.div.offsets = Position.page(this.div);
|
||||||
@@ -104,9 +119,9 @@ OpenLayers.Events.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {str} type
|
* @param {str} type
|
||||||
* @param {event} evt
|
* @param {event} evt
|
||||||
*/
|
*/
|
||||||
triggerEvent: function (type, evt) {
|
triggerEvent: function (type, evt) {
|
||||||
if (evt == null) {
|
if (evt == null) {
|
||||||
evt = {};
|
evt = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user