Merge remote branch 'upstream/master' into 3320

This commit is contained in:
fredj
2011-09-23 15:47:49 +02:00
8 changed files with 120 additions and 15 deletions

View File

@@ -122,7 +122,7 @@ OpenLayers.Control.ArgParser = OpenLayers.Class(OpenLayers.Control, {
this.center = new OpenLayers.LonLat(parseFloat(args.lon),
parseFloat(args.lat));
if (args.zoom) {
this.zoom = parseInt(args.zoom);
this.zoom = parseFloat(args.zoom);
}
// when we add a new baselayer to see when we can set the center

View File

@@ -26,10 +26,14 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
* send a list of strings corresponding to the geometry class names.
*/
geometryTypes: null,
/**
* APIProperty: onStart
* {Function} Define this function if you want to know when a drag starts.
* {Function} *Deprecated*. Register for "beforefeaturemodified" instead.
* The "beforefeaturemodified" event is triggered on the layer before
* any modification begins.
*
* Define this function if you want to know when a drag starts.
* The function should expect to receive two arguments: the feature
* that is about to be dragged and the pixel location of the mouse.
*
@@ -42,7 +46,11 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
/**
* APIProperty: onDrag
* {Function} Define this function if you want to know about each move of a
* {Function} *Deprecated*. Register for "featuremodified" instead.
* The "featuremodified" event is triggered on the layer with each
* feature modification.
*
* Define this function if you want to know about each move of a
* feature. The function should expect to receive two arguments: the
* feature that is being dragged and the pixel location of the mouse.
*
@@ -54,7 +62,11 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
/**
* APIProperty: onComplete
* {Function} Define this function if you want to know when a feature is
* {Function} *Deprecated*. Register for "afterfeaturemodified" instead.
* The "afterfeaturemodified" event is triggered on the layer after
* a feature has been modified.
*
* Define this function if you want to know when a feature is
* done dragging. The function should expect to receive two arguments:
* the feature that is being dragged and the pixel location of the
* mouse.
@@ -273,6 +285,9 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
downFeature: function(pixel) {
this.lastPixel = pixel;
this.onStart(this.feature, pixel);
return this.layer.events.triggerEvent(
"beforefeaturemodified", {feature: this.feature}
);
},
/**
@@ -290,6 +305,8 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
this.layer.drawFeature(this.feature);
this.lastPixel = pixel;
this.onDrag(this.feature, pixel);
this.layer.events.triggerEvent("featuremodified",
{feature: this.feature});
},
/**
@@ -315,6 +332,9 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
*/
doneDragging: function(pixel) {
this.onComplete(this.feature, pixel);
this.layer.events.triggerEvent("afterfeaturemodified", {
feature: this.feature
});
},
/**

View File

@@ -122,6 +122,26 @@ OpenLayers.Request = {
{proxy: OpenLayers.ProxyHost}
);
config = OpenLayers.Util.applyDefaults(config, defaultConfig);
// Always set the "X-Requested-With" header to signal that this request
// was issued through the XHR-object. Since header keys are case
// insensitive and we want to allow overriding of the "X-Requested-With"
// header through the user we cannot use applyDefaults, but have to
// check manually whether we were called with a "X-Requested-With"
// header.
var customRequestedWithHeader = false,
headerKey;
for(headerKey in config.headers) {
if (config.headers.hasOwnProperty( headerKey )) {
if (headerKey.toLowerCase() === 'x-requested-with') {
customRequestedWithHeader = true;
}
}
}
if (customRequestedWithHeader === false) {
// we did not have a custom "X-Requested-With" header
config.headers['X-Requested-With'] = 'XMLHttpRequest';
}
// create request, open, and set headers
var request = new OpenLayers.Request.XMLHttpRequest();

View File

@@ -191,7 +191,7 @@ OpenLayers.Style = OpenLayers.Class({
style.display = "none";
}
if (style.label && typeof style.label !== "string") {
if (style.label != null && typeof style.label !== "string") {
style.label = String(style.label);
}