Merged r1559:r1587 from source:/sandbox/crschmidt/noprototype. OpenLayers is now Prototype-free(tm).
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1588 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Control.js
|
||||
*/
|
||||
OpenLayers.Control.KeyboardDefaults = Class.create();
|
||||
OpenLayers.Control.KeyboardDefaults = OpenLayers.Class.create();
|
||||
OpenLayers.Control.KeyboardDefaults.prototype =
|
||||
Object.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
|
||||
/** @type int */
|
||||
slideFactor: 50,
|
||||
@@ -25,7 +25,7 @@ OpenLayers.Control.KeyboardDefaults.prototype =
|
||||
*
|
||||
*/
|
||||
draw: function() {
|
||||
Event.observe(document,
|
||||
OpenLayers.Event.observe(document,
|
||||
'keypress',
|
||||
this.defaultKeyDown.bind(this));
|
||||
},
|
||||
@@ -35,16 +35,16 @@ OpenLayers.Control.KeyboardDefaults.prototype =
|
||||
*/
|
||||
defaultKeyDown: function (evt) {
|
||||
switch(evt.keyCode) {
|
||||
case Event.KEY_LEFT:
|
||||
case OpenLayers.Event.KEY_LEFT:
|
||||
this.map.pan(-50, 0);
|
||||
break;
|
||||
case Event.KEY_RIGHT:
|
||||
case OpenLayers.Event.KEY_RIGHT:
|
||||
this.map.pan(50, 0);
|
||||
break;
|
||||
case Event.KEY_UP:
|
||||
case OpenLayers.Event.KEY_UP:
|
||||
this.map.pan(0, -50);
|
||||
break;
|
||||
case Event.KEY_DOWN:
|
||||
case OpenLayers.Event.KEY_DOWN:
|
||||
this.map.pan(0, 50);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Control.js
|
||||
*/
|
||||
OpenLayers.Control.LayerSwitcher = Class.create();
|
||||
OpenLayers.Control.LayerSwitcher = OpenLayers.Class.create();
|
||||
OpenLayers.Control.LayerSwitcher.prototype =
|
||||
Object.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
|
||||
/** @type String */
|
||||
activeColor: "darkblue",
|
||||
@@ -129,10 +129,11 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
inputElem.defaultChecked = checked;
|
||||
inputElem.layer = layer;
|
||||
inputElem.control = this;
|
||||
|
||||
if (!baseLayer && !layer.inRange()) {
|
||||
inputElem.disabled = true;
|
||||
}
|
||||
Event.observe(inputElem, "mouseup",
|
||||
OpenLayers.Event.observe(inputElem, "mouseup",
|
||||
this.onInputClick.bindAsEventListener(inputElem));
|
||||
|
||||
// create span
|
||||
@@ -142,7 +143,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
}
|
||||
labelSpan.innerHTML = layer.name;
|
||||
labelSpan.style.verticalAlign = (baseLayer) ? "bottom" : "baseline";
|
||||
Event.observe(labelSpan, "click",
|
||||
OpenLayers.Event.observe(labelSpan, "click",
|
||||
this.onInputClick.bindAsEventListener(inputElem));
|
||||
// create line break
|
||||
var br = document.createElement("br");
|
||||
@@ -185,7 +186,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
this.control.updateMap();
|
||||
}
|
||||
}
|
||||
Event.stop(e);
|
||||
OpenLayers.Event.stop(e);
|
||||
},
|
||||
|
||||
/** Need to update the map accordingly whenever user clicks in either of
|
||||
@@ -237,7 +238,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
this.showControls(false);
|
||||
|
||||
if (e != null) {
|
||||
Event.stop(e);
|
||||
OpenLayers.Event.stop(e);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -254,7 +255,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
this.showControls(true);
|
||||
|
||||
if (e != null) {
|
||||
Event.stop(e);
|
||||
OpenLayers.Event.stop(e);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -292,13 +293,13 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
this.div.style.color = "white";
|
||||
this.div.style.backgroundColor = "transparent";
|
||||
|
||||
Event.observe(this.div, "mouseup",
|
||||
OpenLayers.Event.observe(this.div, "mouseup",
|
||||
this.mouseUp.bindAsEventListener(this));
|
||||
Event.observe(this.div, "click",
|
||||
OpenLayers.Event.observe(this.div, "click",
|
||||
this.ignoreEvent);
|
||||
Event.observe(this.div, "mousedown",
|
||||
OpenLayers.Event.observe(this.div, "mousedown",
|
||||
this.mouseDown.bindAsEventListener(this));
|
||||
Event.observe(this.div, "dblclick", this.ignoreEvent);
|
||||
OpenLayers.Event.observe(this.div, "dblclick", this.ignoreEvent);
|
||||
|
||||
|
||||
// layers list div
|
||||
@@ -325,7 +326,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
|
||||
this.baseLayersDiv = document.createElement("div");
|
||||
this.baseLayersDiv.style.paddingLeft = "10px";
|
||||
/*Event.observe(this.baseLayersDiv, "click",
|
||||
/*OpenLayers.Event.observe(this.baseLayersDiv, "click",
|
||||
this.onLayerClick.bindAsEventListener(this));
|
||||
*/
|
||||
|
||||
@@ -375,7 +376,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
this.maximizeDiv.style.right = "0px";
|
||||
this.maximizeDiv.style.left = "";
|
||||
this.maximizeDiv.style.display = "none";
|
||||
Event.observe(this.maximizeDiv,
|
||||
OpenLayers.Event.observe(this.maximizeDiv,
|
||||
"click",
|
||||
this.maximizeControl.bindAsEventListener(this));
|
||||
|
||||
@@ -394,7 +395,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
this.minimizeDiv.style.right = "0px";
|
||||
this.minimizeDiv.style.left = "";
|
||||
this.minimizeDiv.style.display = "none";
|
||||
Event.observe(this.minimizeDiv,
|
||||
OpenLayers.Event.observe(this.minimizeDiv,
|
||||
"click",
|
||||
this.minimizeControl.bindAsEventListener(this));
|
||||
|
||||
@@ -407,7 +408,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
* @param {Event} evt
|
||||
*/
|
||||
ignoreEvent: function(evt) {
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
/** Register a local 'mouseDown' flag so that we'll know whether or not
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Control.js
|
||||
*/
|
||||
OpenLayers.Control.MouseDefaults = Class.create();
|
||||
OpenLayers.Control.MouseDefaults = OpenLayers.Class.create();
|
||||
OpenLayers.Control.MouseDefaults.prototype =
|
||||
Object.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
|
||||
/** @type Boolean */
|
||||
performedDrag: false,
|
||||
@@ -21,11 +21,11 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
OpenLayers.Control.prototype.initialize.apply(this, arguments);
|
||||
|
||||
//register mousewheel events specifically on the window and document
|
||||
Event.observe(window, "DOMMouseScroll",
|
||||
OpenLayers.Event.observe(window, "DOMMouseScroll",
|
||||
this.onWheelEvent.bindAsEventListener(this));
|
||||
Event.observe(window, "mousewheel",
|
||||
OpenLayers.Event.observe(window, "mousewheel",
|
||||
this.onWheelEvent.bindAsEventListener(this));
|
||||
Event.observe(document, "mousewheel",
|
||||
OpenLayers.Event.observe(document, "mousewheel",
|
||||
this.onWheelEvent.bindAsEventListener(this));
|
||||
},
|
||||
|
||||
@@ -47,7 +47,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
* @type Boolean
|
||||
*/
|
||||
defaultClick: function (evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
var notAfterDrag = !this.performedDrag;
|
||||
this.performedDrag = false;
|
||||
return notAfterDrag;
|
||||
@@ -59,7 +59,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
defaultDblClick: function (evt) {
|
||||
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
|
||||
this.map.setCenter(newCenter, this.map.zoom + 1);
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
return false;
|
||||
},
|
||||
|
||||
@@ -67,7 +67,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
* @param {Event} evt
|
||||
*/
|
||||
defaultMouseDown: function (evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
this.mouseDragStart = evt.xy.clone();
|
||||
this.performedDrag = false;
|
||||
if (evt.shiftKey) {
|
||||
@@ -86,7 +86,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
this.map.viewPortDiv.appendChild(this.zoomBox);
|
||||
}
|
||||
document.onselectstart=function() { return false; }
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -124,7 +124,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
* @param {Event} evt
|
||||
*/
|
||||
defaultMouseUp: function (evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
if (this.zoomBox) {
|
||||
this.zoomBoxEnd(evt);
|
||||
} else {
|
||||
@@ -217,7 +217,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
|
||||
// first determine whether or not the wheeling was inside the map
|
||||
var inMap = false;
|
||||
var elem = Event.element(e);
|
||||
var elem = OpenLayers.Event.element(e);
|
||||
while(elem != null) {
|
||||
if (this.map && elem == this.map.div) {
|
||||
inMap = true;
|
||||
@@ -249,7 +249,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
}
|
||||
|
||||
//only wheel the map, not the window
|
||||
Event.stop(e);
|
||||
OpenLayers.Event.stop(e);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
* @requires OpenLayers/Control.js
|
||||
* @requires OpenLayers/Control/MouseDefaults.js
|
||||
*/
|
||||
OpenLayers.Control.MouseToolbar = Class.create();
|
||||
OpenLayers.Control.MouseToolbar = OpenLayers.Class.create();
|
||||
OpenLayers.Control.MouseToolbar.X = 6;
|
||||
OpenLayers.Control.MouseToolbar.Y = 300;
|
||||
OpenLayers.Control.MouseToolbar.prototype =
|
||||
Object.extend( new OpenLayers.Control(),
|
||||
Object.extend( new OpenLayers.Control.MouseDefaults(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(),
|
||||
OpenLayers.Util.extend( new OpenLayers.Control.MouseDefaults(), {
|
||||
|
||||
mode: null,
|
||||
|
||||
@@ -68,7 +68,7 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
btn.events = new OpenLayers.Events(this, btn, null, true);
|
||||
btn.events.register("mousedown", this, this.buttonDown);
|
||||
btn.events.register("mouseup", this, this.buttonUp);
|
||||
btn.events.register("dblclick", this, Event.stop);
|
||||
btn.events.register("dblclick", this, OpenLayers.Event.stop);
|
||||
btn.action = id;
|
||||
btn.title = title;
|
||||
btn.alt = title;
|
||||
@@ -83,21 +83,21 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
* @param {Event} evt
|
||||
*/
|
||||
buttonDown: function(evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
this.buttonClicked = evt.element.action;
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Event} evt
|
||||
*/
|
||||
buttonUp: function(evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
if (this.buttonClicked != null) {
|
||||
if (this.buttonClicked == evt.element.action) {
|
||||
this.switchModeTo(evt.element.action);
|
||||
}
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
this.buttonClicked = null;
|
||||
}
|
||||
},
|
||||
@@ -110,7 +110,7 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
this.performedDrag = false;
|
||||
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
|
||||
this.map.setCenter(newCenter, this.map.zoom + 1);
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
return false;
|
||||
},
|
||||
|
||||
@@ -118,7 +118,7 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
* @param {Event} evt
|
||||
*/
|
||||
defaultMouseDown: function (evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
this.mouseDragStart = evt.xy.clone();
|
||||
this.performedDrag = false;
|
||||
this.startViaKeyboard = false;
|
||||
@@ -194,7 +194,7 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
break;
|
||||
}
|
||||
document.onselectstart = function() { return false; }
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
switchModeTo: function(mode) {
|
||||
@@ -269,7 +269,7 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
* @param {Event} evt
|
||||
*/
|
||||
defaultMouseUp: function (evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
switch (this.mode) {
|
||||
case "zoombox":
|
||||
this.zoomBoxEnd(evt);
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
*
|
||||
* @requires OpenLayers/Control.js
|
||||
*/
|
||||
OpenLayers.Control.PanZoom = Class.create();
|
||||
OpenLayers.Control.PanZoom = OpenLayers.Class.create();
|
||||
OpenLayers.Control.PanZoom.X = 4;
|
||||
OpenLayers.Control.PanZoom.Y = 4;
|
||||
OpenLayers.Control.PanZoom.prototype =
|
||||
Object.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
|
||||
/** @type int */
|
||||
slideFactor: 50,
|
||||
@@ -101,7 +101,7 @@ OpenLayers.Control.PanZoom.prototype =
|
||||
* @type Boolean
|
||||
*/
|
||||
doubleClick: function (evt) {
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
return false;
|
||||
},
|
||||
|
||||
@@ -109,7 +109,7 @@ OpenLayers.Control.PanZoom.prototype =
|
||||
* @param {Event} evt
|
||||
*/
|
||||
buttonDown: function (evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
|
||||
switch (this.action) {
|
||||
case "panup":
|
||||
@@ -135,7 +135,7 @@ OpenLayers.Control.PanZoom.prototype =
|
||||
break;
|
||||
}
|
||||
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
*
|
||||
* @requires OpenLayers/Control/PanZoom.js
|
||||
*/
|
||||
OpenLayers.Control.PanZoomBar = Class.create();
|
||||
OpenLayers.Control.PanZoomBar = OpenLayers.Class.create();
|
||||
OpenLayers.Control.PanZoomBar.X = 4;
|
||||
OpenLayers.Control.PanZoomBar.Y = 4;
|
||||
OpenLayers.Control.PanZoomBar.prototype =
|
||||
Object.extend( new OpenLayers.Control.PanZoom(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Control.PanZoom(), {
|
||||
|
||||
/** @type Array(...) */
|
||||
buttons: null,
|
||||
@@ -147,12 +147,12 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
* and sets the zoom level appropriately.
|
||||
*/
|
||||
divClick: function (evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
var y = evt.xy.y;
|
||||
var top = Position.page(evt.object)[1];
|
||||
var top = OpenLayers.Util.pagePosition(evt.object)[1];
|
||||
var levels = Math.floor((y - top)/this.zoomStopHeight);
|
||||
this.map.zoomTo((this.map.getNumZoomLevels() -1) - levels);
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
/*
|
||||
@@ -160,13 +160,13 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
* event listener for clicks on the slider
|
||||
*/
|
||||
zoomBarDown:function(evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
this.map.events.register("mousemove", this, this.passEventToSlider);
|
||||
this.map.events.register("mouseup", this, this.passEventToSlider);
|
||||
this.mouseDragStart = evt.xy.clone();
|
||||
this.zoomStart = evt.xy.clone();
|
||||
this.div.style.cursor = "move";
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
/*
|
||||
@@ -178,14 +178,14 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
zoomBarDrag:function(evt) {
|
||||
if (this.mouseDragStart != null) {
|
||||
var deltaY = this.mouseDragStart.y - evt.xy.y
|
||||
var offsets = Position.page(this.zoombarDiv);
|
||||
var offsets = OpenLayers.Util.pagePosition(this.zoombarDiv);
|
||||
if ((evt.clientY - offsets[1]) > 0 &&
|
||||
(evt.clientY - offsets[1]) < parseInt(this.zoombarDiv.style.height) - 2) {
|
||||
var newTop = parseInt(this.slider.style.top) - deltaY;
|
||||
this.slider.style.top = newTop+"px";
|
||||
}
|
||||
this.mouseDragStart = evt.xy.clone();
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -195,7 +195,7 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
* and switch to it.
|
||||
*/
|
||||
zoomBarUp:function(evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
if (this.zoomStart) {
|
||||
this.div.style.cursor="default";
|
||||
this.map.events.unregister("mouseup", this, this.passEventToSlider);
|
||||
@@ -204,7 +204,7 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
this.map.zoomTo(this.map.zoom + Math.round(deltaY/this.zoomStopHeight));
|
||||
this.moveZoomBar();
|
||||
this.mouseDragStart = null;
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Control.js
|
||||
*/
|
||||
OpenLayers.Control.Permalink = Class.create();
|
||||
OpenLayers.Control.Permalink = OpenLayers.Class.create();
|
||||
OpenLayers.Control.Permalink.prototype =
|
||||
Object.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
|
||||
/** @type DOMElement */
|
||||
element: null,
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Control.js
|
||||
*/
|
||||
OpenLayers.Control.Scale = Class.create();
|
||||
OpenLayers.Control.Scale = OpenLayers.Class.create();
|
||||
OpenLayers.Control.Scale.prototype =
|
||||
Object.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
/** @type DOMElement */
|
||||
element: null,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user