Merge branch 'master' of https://github.com/openlayers/openlayers into control-inheritance
This commit is contained in:
@@ -414,4 +414,4 @@
|
||||
/**
|
||||
* Constant: VERSION_NUMBER
|
||||
*/
|
||||
OpenLayers.VERSION_NUMBER="Release 2.12-rc1";
|
||||
OpenLayers.VERSION_NUMBER="Release 2.12-rc3";
|
||||
|
||||
@@ -15,6 +15,14 @@
|
||||
*/
|
||||
OpenLayers.Date = {
|
||||
|
||||
/**
|
||||
* APIProperty: dateRegEx
|
||||
* The regex to be used for validating dates. You can provide your own
|
||||
* regex for instance for adding support for years before BC. Default
|
||||
* value is: /^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/
|
||||
*/
|
||||
dateRegEx: /^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/,
|
||||
|
||||
/**
|
||||
* APIMethod: toISOString
|
||||
* Generates a string representing a date. The format of the string follows
|
||||
@@ -91,7 +99,7 @@ OpenLayers.Date = {
|
||||
*/
|
||||
parse: function(str) {
|
||||
var date;
|
||||
var match = str.match(/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/);
|
||||
var match = str.match(this.dateRegEx);
|
||||
if (match && (match[1] || match[7])) { // must have at least year or time
|
||||
var year = parseInt(match[1], 10) || 0;
|
||||
var month = (parseInt(match[2], 10) - 1) || 0;
|
||||
|
||||
@@ -172,11 +172,18 @@ OpenLayers.Control.Permalink = OpenLayers.Class(OpenLayers.Control, {
|
||||
updateLink: function() {
|
||||
var separator = this.anchor ? '#' : '?';
|
||||
var href = this.base;
|
||||
var anchor = null;
|
||||
if (href.indexOf("#") != -1 && this.anchor == false) {
|
||||
anchor = href.substring( href.indexOf("#"), href.length);
|
||||
}
|
||||
if (href.indexOf(separator) != -1) {
|
||||
href = href.substring( 0, href.indexOf(separator) );
|
||||
}
|
||||
|
||||
href += separator + OpenLayers.Util.getParameterString(this.createParams());
|
||||
var splits = href.split("#");
|
||||
href = splits[0] + separator+ OpenLayers.Util.getParameterString(this.createParams());
|
||||
if (anchor) {
|
||||
href += anchor;
|
||||
}
|
||||
if (this.anchor && !this.element) {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
|
||||
/**
|
||||
* @requires OpenLayers/Format/WKT.js
|
||||
* @requires OpenLayers/Filter/Comparison.js
|
||||
* @requires OpenLayers/Filter/Logical.js
|
||||
* @requires OpenLayers/Filter/Spatial.js
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -275,16 +275,6 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
* {Float}
|
||||
*/
|
||||
minResolution: null,
|
||||
|
||||
/**
|
||||
* Property: resolution
|
||||
* {Float} Current resolution that the layer is drawn in. This is
|
||||
* used to determine whether the zoom has changed when calling
|
||||
* <moveTo> from <redraw>. Subclasses may set this.resolution to
|
||||
* null prior to calling redraw to force passing zoomChanged
|
||||
* true to moveTo.
|
||||
*/
|
||||
resolution: null,
|
||||
|
||||
/**
|
||||
* APIProperty: numZoomLevels
|
||||
@@ -338,6 +328,11 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
|
||||
this.metadata = {};
|
||||
|
||||
options = OpenLayers.Util.extend({}, options);
|
||||
// make sure we respect alwaysInRange if set on the prototype
|
||||
if (this.alwaysInRange != null) {
|
||||
options.alwaysInRange = this.alwaysInRange;
|
||||
}
|
||||
this.addOptions(options);
|
||||
|
||||
this.name = name;
|
||||
@@ -561,8 +556,7 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
var extent = this.getExtent();
|
||||
|
||||
if (extent && this.inRange && this.visibility) {
|
||||
var zoomChanged = this.resolution == null ||
|
||||
this.resolution !== this.map.getResolution();
|
||||
var zoomChanged = true;
|
||||
this.moveTo(extent, zoomChanged, false);
|
||||
this.events.triggerEvent("moveend",
|
||||
{"zoomChanged": zoomChanged});
|
||||
@@ -587,7 +581,6 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
display = display && this.inRange;
|
||||
}
|
||||
this.display(display);
|
||||
this.resolution = this.map.getResolution();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -643,8 +636,6 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
|
||||
// deal with gutters
|
||||
this.setTileSize();
|
||||
|
||||
this.resolution = null;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -858,7 +849,7 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
alwaysInRange = false;
|
||||
}
|
||||
}
|
||||
if(this.alwaysInRange == null) {
|
||||
if(this.options.alwaysInRange == null) {
|
||||
this.alwaysInRange = alwaysInRange;
|
||||
}
|
||||
|
||||
@@ -884,16 +875,6 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
props.resolutions = this.resolutionsFromScales(props.scales);
|
||||
}
|
||||
if(props.resolutions == null) {
|
||||
var maxExtent = this.maxExtent;
|
||||
if (!props.maxResolution && maxExtent) {
|
||||
// maxResolution for default grid sets assumes that at zoom
|
||||
// level zero, the whole world fits on one tile.
|
||||
var tileSize = this.tileSize || this.map.getTileSize();
|
||||
props.maxResolution = Math.max(
|
||||
maxExtent.getWidth() / tileSize.w,
|
||||
maxExtent.getHeight() / tileSize.h
|
||||
);
|
||||
}
|
||||
props.resolutions = this.calculateResolutions(props);
|
||||
}
|
||||
}
|
||||
@@ -1029,6 +1010,18 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
minResolution = Math.max(wRes, hRes);
|
||||
}
|
||||
|
||||
if(typeof maxResolution !== "number" &&
|
||||
typeof minResolution !== "number" &&
|
||||
this.maxExtent != null) {
|
||||
// maxResolution for default grid sets assumes that at zoom
|
||||
// level zero, the whole world fits on one tile.
|
||||
var tileSize = this.map.getTileSize();
|
||||
maxResolution = Math.max(
|
||||
this.maxExtent.getWidth() / tileSize.w,
|
||||
this.maxExtent.getHeight() / tileSize.h
|
||||
);
|
||||
}
|
||||
|
||||
// determine numZoomLevels
|
||||
var maxZoomLevel = props.maxZoomLevel;
|
||||
var numZoomLevels = props.numZoomLevels;
|
||||
@@ -1299,6 +1292,11 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
var childNodes = this.div.childNodes;
|
||||
for(var i = 0, len = childNodes.length; i < len; ++i) {
|
||||
var element = childNodes[i].firstChild || childNodes[i];
|
||||
var lastChild = childNodes[i].lastChild;
|
||||
//TODO de-uglify this
|
||||
if (lastChild && lastChild.nodeName.toLowerCase() === "iframe") {
|
||||
element = lastChild.parentNode;
|
||||
}
|
||||
OpenLayers.Util.modifyDOMElement(element, null, null, null,
|
||||
null, null, null, opacity);
|
||||
}
|
||||
|
||||
@@ -176,6 +176,18 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, {
|
||||
res.zoomMax + 1 - res.zoomMin, this.numZoomLevels
|
||||
)
|
||||
}, true);
|
||||
this.updateAttribution();
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: drawTileFromQueue
|
||||
* Draws the first tile from the tileQueue, and unqueues that tile
|
||||
*/
|
||||
drawTileFromQueue: function() {
|
||||
// don't start working on the queue before we have a url from initLayer
|
||||
if (this.url) {
|
||||
OpenLayers.Layer.XYZ.prototype.drawTileFromQueue.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -185,9 +197,6 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, {
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
*/
|
||||
getURL: function(bounds) {
|
||||
if (!this.url) {
|
||||
return;
|
||||
}
|
||||
var xyz = this.getXYZ(bounds), x = xyz.x, y = xyz.y, z = xyz.z;
|
||||
var quadDigits = [];
|
||||
for (var i = z; i > 0; --i) {
|
||||
@@ -223,7 +232,8 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, {
|
||||
this.map.getProjectionObject(),
|
||||
new OpenLayers.Projection("EPSG:4326")
|
||||
);
|
||||
var providers = res.imageryProviders, zoom = this.map.getZoom() + 1,
|
||||
var providers = res.imageryProviders,
|
||||
zoom = this.serverResolutions.indexOf(this.getServerResolution()),
|
||||
copyrights = "", provider, i, ii, j, jj, bbox, coverage;
|
||||
for (i=0,ii=providers.length; i<ii; ++i) {
|
||||
provider = providers[i];
|
||||
@@ -253,7 +263,6 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, {
|
||||
*/
|
||||
setMap: function() {
|
||||
OpenLayers.Layer.XYZ.prototype.setMap.apply(this, arguments);
|
||||
this.updateAttribution();
|
||||
this.map.events.register("moveend", this, this.updateAttribution);
|
||||
},
|
||||
|
||||
|
||||
@@ -651,14 +651,18 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
||||
|
||||
/**
|
||||
* Method: getServerZoom
|
||||
* Return the zoom value corresponding to the best zoom supported by the server
|
||||
* resolution.
|
||||
* Return the zoom value corresponding to the best matching server
|
||||
* resolution, taking into account <serverResolutions> and <zoomOffset>.
|
||||
*
|
||||
* Returns:
|
||||
* {Number} The closest server supported zoom.
|
||||
* {Number} The closest server supported zoom. This is not the map zoom
|
||||
* level, but an index of the server's resolutions array.
|
||||
*/
|
||||
getServerZoom: function() {
|
||||
return this.map.getZoomForResolution(this.getServerResolution());
|
||||
var resolution = this.getServerResolution();
|
||||
return this.serverResolutions ?
|
||||
OpenLayers.Util.indexOf(this.serverResolutions, resolution) :
|
||||
this.map.getZoomForResolution(resolution) + (this.zoomOffset || 0);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -122,7 +122,6 @@ OpenLayers.Layer.HTTPRequest = OpenLayers.Class(OpenLayers.Layer, {
|
||||
*/
|
||||
mergeNewParams:function(newParams) {
|
||||
this.params = OpenLayers.Util.extend(this.params, newParams);
|
||||
this.resolution = null;
|
||||
var ret = this.redraw();
|
||||
if(this.map != null) {
|
||||
this.map.events.triggerEvent("changelayer", {
|
||||
@@ -147,7 +146,7 @@ OpenLayers.Layer.HTTPRequest = OpenLayers.Class(OpenLayers.Layer, {
|
||||
if (force) {
|
||||
return this.mergeNewParams({"_olSalt": Math.random()});
|
||||
} else {
|
||||
return OpenLayers.Layer.prototype.redraw.call(this);
|
||||
return OpenLayers.Layer.prototype.redraw.apply(this, []);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -173,9 +173,7 @@ OpenLayers.Layer.TMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
var res = this.getServerResolution();
|
||||
var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w));
|
||||
var y = Math.round((bounds.bottom - this.tileOrigin.lat) / (res * this.tileSize.h));
|
||||
var z = this.serverResolutions != null ?
|
||||
OpenLayers.Util.indexOf(this.serverResolutions, res) :
|
||||
this.getServerZoom() + this.zoomOffset;
|
||||
var z = this.getServerZoom();
|
||||
var path = this.serviceVersion + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type;
|
||||
var url = this.url;
|
||||
if (OpenLayers.Util.isArray(url)) {
|
||||
|
||||
@@ -520,20 +520,6 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: redraw
|
||||
* Redraws the layer. Returns true if the layer was redrawn, false if not.
|
||||
*
|
||||
* Returns:
|
||||
* {Boolean} The layer was redrawn.
|
||||
*/
|
||||
redraw: function() {
|
||||
// this is to force Layer.redraw set zoomChanged
|
||||
// to true in the moveTo call
|
||||
this.resolution = null;
|
||||
return OpenLayers.Layer.prototype.redraw.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: display
|
||||
* Hide or show the Layer
|
||||
|
||||
@@ -332,10 +332,7 @@ OpenLayers.Layer.WMTS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
* Get the current index in the matrixIds array.
|
||||
*/
|
||||
getIdentifier: function() {
|
||||
return this.serverResolutions != null ?
|
||||
OpenLayers.Util.indexOf(this.serverResolutions,
|
||||
this.getServerResolution()) :
|
||||
this.getServerZoom() + this.zoomOffset;
|
||||
return this.getServerZoom();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -143,10 +143,7 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
(res * this.tileSize.w));
|
||||
var y = Math.round((this.maxExtent.top - bounds.top) /
|
||||
(res * this.tileSize.h));
|
||||
var resolutions = this.serverResolutions || this.resolutions;
|
||||
var z = this.zoomOffset == 0 ?
|
||||
OpenLayers.Util.indexOf(resolutions, res) :
|
||||
this.getServerZoom() + this.zoomOffset;
|
||||
var z = this.getServerZoom();
|
||||
|
||||
if (this.wrapDateLine) {
|
||||
var limit = Math.pow(2, z);
|
||||
|
||||
@@ -580,8 +580,8 @@ OpenLayers.Map = OpenLayers.Class({
|
||||
|
||||
// Because Mozilla does not support the "resize" event for elements
|
||||
// other than "window", we need to put a hack here.
|
||||
if (OpenLayers.String.contains(navigator.appName, "Microsoft")) {
|
||||
// If IE, register the resize on the div
|
||||
if (parseFloat(navigator.appVersion.split("MSIE")[1]) < 9) {
|
||||
// If IE < 9, register the resize on the div
|
||||
this.events.register("resize", this, this.updateSize);
|
||||
} else {
|
||||
// Else updateSize on catching the window's resize
|
||||
@@ -1634,8 +1634,10 @@ OpenLayers.Map = OpenLayers.Class({
|
||||
this.panTo(newCenterLonLat);
|
||||
} else {
|
||||
this.moveTo(newCenterLonLat);
|
||||
this.dragging = false;
|
||||
this.events.triggerEvent("moveend");
|
||||
if(this.dragging) {
|
||||
this.dragging = false;
|
||||
this.events.triggerEvent("moveend");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -799,7 +799,7 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
|
||||
if (data[3] === 255) { // antialiased
|
||||
var id = data[2] + (256 * (data[1] + (256 * data[0])));
|
||||
if (id) {
|
||||
featureId = "OpenLayers.Feature.Vector_" + (id - 1 + this.hitOverflow);
|
||||
featureId = "OpenLayers_Feature_Vector_" + (id - 1 + this.hitOverflow);
|
||||
try {
|
||||
feature = this.features[featureId][0];
|
||||
} catch(err) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
/**
|
||||
* @requires OpenLayers/Events.js
|
||||
* @requires OpenLayers/Request/XMLHttpRequest.js
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -19,7 +20,14 @@ OpenLayers.ProxyHost = "";
|
||||
* with XMLHttpRequests. These methods work with a cross-browser
|
||||
* W3C compliant <OpenLayers.Request.XMLHttpRequest> class.
|
||||
*/
|
||||
OpenLayers.Request = {
|
||||
if (!OpenLayers.Request) {
|
||||
/**
|
||||
* This allows for OpenLayers/Request/XMLHttpRequest.js to be included
|
||||
* before or after this script.
|
||||
*/
|
||||
OpenLayers.Request = {};
|
||||
}
|
||||
OpenLayers.Util.extend(OpenLayers.Request, {
|
||||
|
||||
/**
|
||||
* Constant: DEFAULT_CONFIG
|
||||
@@ -419,4 +427,4 @@ OpenLayers.Request = {
|
||||
return OpenLayers.Request.issue(config);
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
@@ -447,5 +447,12 @@
|
||||
* XMLHttpRequest object. From
|
||||
* http://code.google.com/p/xmlhttprequest/.
|
||||
*/
|
||||
if (!OpenLayers.Request) {
|
||||
/**
|
||||
* This allows for OpenLayers/Request.js to be included
|
||||
* before or after this script.
|
||||
*/
|
||||
OpenLayers.Request = {};
|
||||
}
|
||||
OpenLayers.Request.XMLHttpRequest = cXMLHttpRequest;
|
||||
})();
|
||||
|
||||
@@ -7,7 +7,7 @@ var OpenLayers = {
|
||||
/**
|
||||
* Constant: VERSION_NUMBER
|
||||
*/
|
||||
VERSION_NUMBER: "Release 2.12-rc1",
|
||||
VERSION_NUMBER: "Release 2.12-rc3",
|
||||
|
||||
/**
|
||||
* Constant: singleFile
|
||||
|
||||
@@ -61,7 +61,7 @@ OpenLayers.Style = OpenLayers.Class({
|
||||
rules: null,
|
||||
|
||||
/**
|
||||
* Property: context
|
||||
* APIProperty: context
|
||||
* {Object} An optional object with properties that symbolizers' property
|
||||
* values should be evaluated against. If no context is specified,
|
||||
* feature.attributes will be used
|
||||
|
||||
@@ -211,7 +211,8 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
|
||||
*/
|
||||
positionTile: function() {
|
||||
var style = this.getTile().style,
|
||||
size = this.layer.getImageSize(this.bounds);
|
||||
size = this.frame ? this.size :
|
||||
this.layer.getImageSize(this.bounds);
|
||||
style.left = this.position.x + "%";
|
||||
style.top = this.position.y + "%";
|
||||
style.width = size.w + "%";
|
||||
@@ -254,11 +255,16 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
|
||||
this.imgDiv.galleryImg = "no";
|
||||
|
||||
var style = this.imgDiv.style;
|
||||
if (this.layer.gutter) {
|
||||
var left = this.layer.gutter / this.layer.tileSize.w * 100;
|
||||
var top = this.layer.gutter / this.layer.tileSize.h * 100;
|
||||
if (this.frame) {
|
||||
var left = 0, top = 0;
|
||||
if (this.layer.gutter) {
|
||||
left = this.layer.gutter / this.layer.tileSize.w * 100;
|
||||
top = this.layer.gutter / this.layer.tileSize.h * 100;
|
||||
}
|
||||
style.left = -left + "%";
|
||||
style.top = -top + "%";
|
||||
style.width = (2 * left + 100) + "%";
|
||||
style.height = (2 * top + 100) + "%";
|
||||
}
|
||||
style.visibility = "hidden";
|
||||
style.opacity = 0;
|
||||
@@ -275,8 +281,6 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
|
||||
style.width = "100%";
|
||||
}
|
||||
if (this.frame) {
|
||||
style.width = "100%";
|
||||
style.height = "100%";
|
||||
this.frame.appendChild(this.imgDiv);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,6 +196,19 @@ OpenLayers.Tile.Image.IFrame = {
|
||||
OpenLayers.Tile.Image.prototype.setImgSrc.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: onImageLoad
|
||||
* Handler for the image onload event
|
||||
*/
|
||||
onImageLoad: function() {
|
||||
//TODO de-uglify opacity handling
|
||||
OpenLayers.Tile.Image.prototype.onImageLoad.apply(this, arguments);
|
||||
if (this.useIFrame === true) {
|
||||
this.imgDiv.style.opacity = 1;
|
||||
this.frame.style.opacity = this.layer.opacity;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: createBackBuffer
|
||||
|
||||
@@ -71,7 +71,7 @@ OpenLayers.Util.isElement = function(o) {
|
||||
* {Boolean} true if the object is an array.
|
||||
*/
|
||||
OpenLayers.Util.isArray = function(a) {
|
||||
return (Object.prototype.toString.call(a) === '[object Array]');
|
||||
return (Object.prototype.toString.call(a) === '[object Array]');
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -112,7 +112,7 @@ OpenLayers.Util.removeItem = function(array, item) {
|
||||
* obj - {*}
|
||||
*
|
||||
* Returns:
|
||||
* {Integer} The index at, which the first object was found in the array.
|
||||
* {Integer} The index at which the first object was found in the array.
|
||||
* If not found, returns -1.
|
||||
*/
|
||||
OpenLayers.Util.indexOf = function(array, obj) {
|
||||
@@ -130,6 +130,17 @@ OpenLayers.Util.indexOf = function(array, obj) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Property: dotless
|
||||
* {RegExp}
|
||||
* Compiled regular expression to match dots ("."). This is used for replacing
|
||||
* dots in identifiers. Because object identifiers are frequently used for
|
||||
* DOM element identifiers by the library, we avoid using dots to make for
|
||||
* more sensible CSS selectors.
|
||||
*
|
||||
* TODO: Use a module pattern to avoid bloating the API with stuff like this.
|
||||
*/
|
||||
OpenLayers.Util.dotless = /\./g;
|
||||
|
||||
/**
|
||||
* Function: modifyDOMElement
|
||||
@@ -139,7 +150,8 @@ OpenLayers.Util.indexOf = function(array, obj) {
|
||||
*
|
||||
* Parameters:
|
||||
* element - {DOMElement} DOM element to modify.
|
||||
* id - {String} The element id attribute to set.
|
||||
* id - {String} The element id attribute to set. Note that dots (".") will be
|
||||
* replaced with underscore ("_") in setting the element id.
|
||||
* px - {<OpenLayers.Pixel>|Object} The element left and top position,
|
||||
* OpenLayers.Pixel or an object with
|
||||
* a 'x' and 'y' properties.
|
||||
@@ -157,7 +169,7 @@ OpenLayers.Util.modifyDOMElement = function(element, id, px, sz, position,
|
||||
border, overflow, opacity) {
|
||||
|
||||
if (id) {
|
||||
element.id = id;
|
||||
element.id = id.replace(OpenLayers.Util.dotless, "_");
|
||||
}
|
||||
if (px) {
|
||||
element.style.left = px.x + "px";
|
||||
@@ -195,7 +207,8 @@ OpenLayers.Util.modifyDOMElement = function(element, id, px, sz, position,
|
||||
* Parameters:
|
||||
* id - {String} An identifier for this element. If no id is
|
||||
* passed an identifier will be created
|
||||
* automatically.
|
||||
* automatically. Note that dots (".") will be replaced with
|
||||
* underscore ("_") when generating ids.
|
||||
* px - {<OpenLayers.Pixel>|Object} The element left and top position,
|
||||
* OpenLayers.Pixel or an object with
|
||||
* a 'x' and 'y' properties.
|
||||
@@ -928,6 +941,7 @@ OpenLayers.Util.lastSeqID = 0;
|
||||
*
|
||||
* Parameters:
|
||||
* prefix - {String} Optional string to prefix unique id. Default is "id_".
|
||||
* Note that dots (".") in the prefix will be replaced with underscore ("_").
|
||||
*
|
||||
* Returns:
|
||||
* {String} A unique id string, built on the passed in prefix.
|
||||
@@ -935,6 +949,8 @@ OpenLayers.Util.lastSeqID = 0;
|
||||
OpenLayers.Util.createUniqueID = function(prefix) {
|
||||
if (prefix == null) {
|
||||
prefix = "id_";
|
||||
} else {
|
||||
prefix = prefix.replace(OpenLayers.Util.dotless, "_");
|
||||
}
|
||||
OpenLayers.Util.lastSeqID += 1;
|
||||
return prefix + OpenLayers.Util.lastSeqID;
|
||||
|
||||
Reference in New Issue
Block a user