Making sketch handlers work over the dateline by using layer.getLonLatFromViewPortPx instead of map.getLonLatFromPixel. Thanks bartvde for the unit and acceptance tests. r=bartvde (closes #2787)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@12346 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2011-09-08 17:53:44 +00:00
parent 21423cefe2
commit 98be6e313b
10 changed files with 175 additions and 23 deletions

View File

@@ -24,6 +24,13 @@
OpenLayers.Control.EditingToolbar = OpenLayers.Class(
OpenLayers.Control.Panel, {
/**
* APIProperty: citeCompliant
* {Boolean} If set to true, coordinates of features drawn in a map extent
* crossing the date line won't exceed the world bounds. Default is false.
*/
citeCompliant: false,
/**
* Constructor: OpenLayers.Control.EditingToolbar
* Create an editing toolbar for a given layer.
@@ -39,9 +46,18 @@ OpenLayers.Control.EditingToolbar = OpenLayers.Class(
[ new OpenLayers.Control.Navigation() ]
);
var controls = [
new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Point, {'displayClass': 'olControlDrawFeaturePoint'}),
new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Path, {'displayClass': 'olControlDrawFeaturePath'}),
new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Polygon, {'displayClass': 'olControlDrawFeaturePolygon'})
new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Point, {
displayClass: 'olControlDrawFeaturePoint',
handlerOptions: {citeCompliant: this.citeCompliant}
}),
new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Path, {
displayClass: 'olControlDrawFeaturePath',
handlerOptions: {citeCompliant: this.citeCompliant}
}),
new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Polygon, {
displayClass: 'olControlDrawFeaturePolygon',
handlerOptions: {citeCompliant: this.citeCompliant}
})
];
this.addControls(controls);
},