adding commenting/readability to initialize()
git-svn-id: http://svn.openlayers.org/trunk/openlayers@864 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -28,6 +28,7 @@ OpenLayers.Events.prototype = {
|
||||
/** @type Array: list of support application events */
|
||||
eventTypes: null,
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
@@ -37,31 +38,41 @@ OpenLayers.Events.prototype = {
|
||||
* @param {Array} eventTypes Array of custom application events
|
||||
*/
|
||||
initialize: function (object, div, eventTypes) {
|
||||
this.listeners = {};
|
||||
this.object = object;
|
||||
this.div = div;
|
||||
this.eventTypes = eventTypes;
|
||||
|
||||
if (eventTypes) {
|
||||
this.listeners = new Object();
|
||||
|
||||
// if eventTypes is specified, create a listeners list for each
|
||||
// custom application event.
|
||||
if (eventTypes != null) {
|
||||
|
||||
for (var i = 0; i < this.eventTypes.length; i++) {
|
||||
// create a listener list for every custom application event
|
||||
this.listeners[ this.eventTypes[i] ] = [];
|
||||
this.listeners[ this.eventTypes[i] ] = new Array();
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < this.BROWSER_EVENTS.length; i++) {
|
||||
var eventType = this.BROWSER_EVENTS[i];
|
||||
|
||||
// every browser event has a corresponding application event
|
||||
// (whether it's listened for or not).
|
||||
this.listeners[ eventType ] = [];
|
||||
// if a dom element is specified, add a listeners list
|
||||
// for browser events on the element and register them
|
||||
if (div != null) {
|
||||
|
||||
Event.observe(div, eventType,
|
||||
this.handleBrowserEvent.bindAsEventListener(this));
|
||||
for (var i = 0; i < this.BROWSER_EVENTS.length; i++) {
|
||||
var eventType = this.BROWSER_EVENTS[i];
|
||||
|
||||
// every browser event has a corresponding application event
|
||||
// (whether it's listened for or not).
|
||||
this.listeners[ eventType ] = new Array();
|
||||
|
||||
// use Prototype to register the event cross-browser
|
||||
Event.observe(div, eventType,
|
||||
this.handleBrowserEvent.bindAsEventListener(this));
|
||||
}
|
||||
|
||||
// disable dragstart in IE so that mousedown/move/up works normally
|
||||
Event.observe(div, "dragstart", Event.stop);
|
||||
}
|
||||
|
||||
// disable dragstart in IE so that mousedown/move/up works normally
|
||||
Event.observe(div, "dragstart", Event.stop);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user