[OpenLayers-Commits] r11836 - in trunk/openlayers:
lib/OpenLayers/Handler tests/Handler
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Thu Mar 31 07:35:27 EDT 2011
Author: erilem
Date: 2011-03-31 04:35:24 -0700 (Thu, 31 Mar 2011)
New Revision: 11836
Modified:
trunk/openlayers/lib/OpenLayers/Handler/Path.js
trunk/openlayers/tests/Handler/Path.html
Log:
when drawing make sure the point follow the cursor, even after zooming in or out, p=jorix, r=me (closes #3195)
Modified: trunk/openlayers/lib/OpenLayers/Handler/Path.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Handler/Path.js 2011-03-31 11:35:15 UTC (rev 11835)
+++ trunk/openlayers/lib/OpenLayers/Handler/Path.js 2011-03-31 11:35:24 UTC (rev 11836)
@@ -157,6 +157,7 @@
this.line.geometry.addComponent(
this.point.geometry, this.line.geometry.components.length
);
+ this.layer.addFeatures([this.point]);
this.callback("point", [this.point.geometry, this.getGeometry()]);
this.callback("modify", [this.point.geometry, this.getSketch()]);
this.drawFeature();
Modified: trunk/openlayers/tests/Handler/Path.html
===================================================================
--- trunk/openlayers/tests/Handler/Path.html 2011-03-31 11:35:15 UTC (rev 11835)
+++ trunk/openlayers/tests/Handler/Path.html 2011-03-31 11:35:24 UTC (rev 11836)
@@ -105,7 +105,7 @@
}
function test_bounds(t) {
- t.plan(2);
+ t.plan(5);
var geometry;
var map = new OpenLayers.Map('map');
map.addLayer(new OpenLayers.Layer.WMS("", "", {}));
@@ -115,16 +115,22 @@
var handler = new OpenLayers.Handler.Path(control, {},
{stopDown: true, stopUp: true});
var activated = handler.activate();
+ t.eq(handler.layer.features.length, 2,
+ "There are two features in the layer after activation.");
// click on (150, 75)
var evt = {xy: new OpenLayers.Pixel(150, 75), which: 1};
handler.mousemove(evt);
handler.mousedown(evt);
handler.mouseup(evt);
+ t.eq(handler.layer.features.length, 2,
+ "There are two features in the layer after first click.");
// click on (175, 100)
evt = {xy: new OpenLayers.Pixel(175, 100), which: 1};
handler.mousemove(evt);
handler.mousedown(evt);
handler.mouseup(evt);
+ t.eq(handler.layer.features.length, 2,
+ "There are two features in the layer after second click.");
t.ok(handler.line.geometry.getBounds().equals(
new OpenLayers.Bounds(0,-35.15625,35.15625,0)),
"Correct bounds");
More information about the Commits
mailing list