when zooming out right after drawing a polygon or a line a point appears in the upper left corner, p=jorix, r=me (closes #3196)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11745 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2011-03-29 12:00:58 +00:00
parent 33d330c0db
commit 0276351f50
4 changed files with 82 additions and 31 deletions

View File

@@ -75,13 +75,14 @@ OpenLayers.Handler.Polygon = OpenLayers.Class(OpenLayers.Handler.Path, {
* feature.
*/
createFeature: function(pixel) {
if(!pixel) {
pixel = new OpenLayers.Pixel(-50, -50);
var geometry;
if(pixel) {
var lonlat = this.map.getLonLatFromPixel(pixel);
geometry = new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat);
} else {
geometry = new OpenLayers.Geometry.Point();
}
var lonlat = this.control.map.getLonLatFromPixel(pixel);
this.point = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat)
);
this.point = new OpenLayers.Feature.Vector(geometry);
this.line = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.LinearRing([this.point.geometry])
);