X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/b95e9d27599ee55b2fd61a444acc3264c7637265..b2b6892a4553eeaa8d601737dee440eba0c6d6a6:/public/lib/OpenLayers/Control.js diff --git a/public/lib/OpenLayers/Control.js b/public/lib/OpenLayers/Control.js new file mode 100644 index 000000000..117fb26c4 --- /dev/null +++ b/public/lib/OpenLayers/Control.js @@ -0,0 +1,63 @@ +/* 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.Control = Class.create(); +OpenLayers.Control.prototype = { + + /** this gets set in the addControl() function in OpenLayers.Map + * @type OpenLayers.Map */ + map: null, + + /** @type DOMElement */ + div: null, + + /** @type OpenLayers.Pixel */ + position: null, + + /** + * @constructor + */ + initialize: function (options) { + Object.extend(this, options); + }, + + /** + * @param {OpenLayers.Pixel} px + * + * @returns A reference to the DIV DOMElement containing the control + * @type DOMElement + */ + draw: function (px) { + if (this.div == null) { + this.div = OpenLayers.Util.createDiv(); + } + if (px != null) { + this.position = px.copyOf(); + } + this.moveTo(this.position); + return this.div; + }, + + /** + * @param {OpenLayers.Pixel} px + */ + moveTo: function (px) { + if ((px != null) && (this.div != null)) { + this.div.style.left = px.x + "px"; + this.div.style.top = px.x + "px"; + } + }, + + /** + */ + destroy: function () { + // eliminate circular references + this.map = null; + }, + + /** @final @type String */ + CLASS_NAME: "OpenLayers.Control" +};