[OpenLayers-Commits] r11098 - in sandbox/elemoine/draw-feature:
lib/OpenLayers/Control tests/Control
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Thu Feb 10 14:59:45 EST 2011
Author: erilem
Date: 2011-02-10 11:59:45 -0800 (Thu, 10 Feb 2011)
New Revision: 11098
Modified:
sandbox/elemoine/draw-feature/lib/OpenLayers/Control/Measure.js
sandbox/elemoine/draw-feature/tests/Control/Measure.html
Log:
adapt the Measure control, and make the Measure tests pass
Modified: sandbox/elemoine/draw-feature/lib/OpenLayers/Control/Measure.js
===================================================================
--- sandbox/elemoine/draw-feature/lib/OpenLayers/Control/Measure.js 2011-02-10 19:59:31 UTC (rev 11097)
+++ sandbox/elemoine/draw-feature/lib/OpenLayers/Control/Measure.js 2011-02-10 19:59:45 UTC (rev 11098)
@@ -237,8 +237,8 @@
* Parameters: point - {<OpenLayers.Geometry.Point>} The point at the
* mouseposition. feature - {<OpenLayers.Feature.Vector>} The sketch feature.
*/
- measureImmediate : function(point, feature) {
- if (this.delayedTrigger === null &&
+ measureImmediate : function(point, feature, drawing) {
+ if (drawing && this.delayedTrigger === null &&
!this.handler.freehandMode(this.handler.evt)) {
this.measure(feature.geometry, "measurepartial");
}
Modified: sandbox/elemoine/draw-feature/tests/Control/Measure.html
===================================================================
--- sandbox/elemoine/draw-feature/tests/Control/Measure.html 2011-02-10 19:59:31 UTC (rev 11097)
+++ sandbox/elemoine/draw-feature/tests/Control/Measure.html 2011-02-10 19:59:45 UTC (rev 11098)
@@ -52,6 +52,7 @@
xy: new OpenLayers.Pixel(x, y)
})
};
+ trigger("mousemove", 0, 0);
trigger("mousedown", 0, 0);
trigger("mouseup", 0, 0);
trigger("mousemove", 10, 10);
@@ -60,9 +61,10 @@
// confirm that the sketch persists
t.eq(control.handler.layer.features.length, 1, "feature persists");
- // cancel and see that sketch is gone
+ // cancel and see that sketch is gone (do not forget that
+ // cancel will create the new feature)
control.cancel();
- t.eq(control.handler.layer.features.length, 0, "feature is gone after cancel");
+ t.eq(control.handler.layer.features.length, 2, "feature is gone after cancel");
map.destroy();
@@ -112,6 +114,7 @@
var delay = control.partialDelay / 1000;
// establish first point
+ trigger("mousemove", 0, 0);
trigger("mousedown", 0, 0);
trigger("mouseup", 0, 0);
@@ -187,6 +190,7 @@
log = [];
// f) establish first freehand point
+ trigger("mousemove", 0, 0);
trigger("mousedown", 0, 0);
t.eq(log.length, 0, "f) no event fired yet")
@@ -267,6 +271,7 @@
var delay = control.partialDelay / 1000;
// a) establish first point
+ trigger("mousemove", 0, 0);
trigger("mousedown", 0, 0);
trigger("mouseup", 0, 0);
More information about the Commits
mailing list