Made Events class more generic; the Events constructor now takes a list of supported application event types. Added tests for the Events class.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@61 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Schuyler Erle
2006-05-16 21:48:56 +00:00
parent d4fd4f7803
commit ce6c4acd63
4 changed files with 87 additions and 28 deletions

View File

@@ -9,6 +9,13 @@ OpenLayers.Map.prototype = {
// Hash: base z-indexes for different classes of thing
Z_INDEX_BASE: { Layer: 100, Popup: 200, Control: 250 },
// Array: supported application event types
EVENT_TYPES: [
"addlayer", "removelayer", "movestart", "move", "moveend",
"zoomend", "layerchanged", "popupopen", "popupclose",
"addmarker", "removemarker", "clearmarkers", "mouseover",
"mouseout", "mousemove", "dragstart", "drag", "dragend" ],
// int: zoom levels, used to draw zoom dragging control and limit zooming
maxZoomLevel: 16,
@@ -56,7 +63,7 @@ OpenLayers.Map.prototype = {
initialize: function (div, options) {
Object.extend(this, options);
this.div = $(div);
this.div = div = $(div);
this.viewPortDiv = OpenLayers.Util.createDiv(
div.id + "_OpenLayers_ViewPort" );
@@ -75,12 +82,13 @@ OpenLayers.Map.prototype = {
div.id + "_OpenLayers_Container" );
this.viewPortDiv.appendChild(this.layerContainerDiv);
this.events = new OpenLayers.Events(this, div, this.EVENT_TYPES);
this.layers = [];
this.controls = [];
this.addControl( new OpenLayers.Control.PanZoom() );
this.events = new OpenLayers.Events(this, div);
this.events.register( "dblclick", this, this.defaultDblClick );
this.events.register( "mousedown", this, this.defaultMouseDown );
this.events.register( "mouseup", this, this.defaultMouseUp );