[OpenLayers-Commits] r11562 - in sandbox/ahocevar/3072:
lib/OpenLayers/Handler tests/Handler
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Sun Feb 27 09:54:34 EST 2011
Author: ahocevar
Date: 2011-02-27 06:54:33 -0800 (Sun, 27 Feb 2011)
New Revision: 11562
Modified:
sandbox/ahocevar/3072/lib/OpenLayers/Handler/Path.js
sandbox/ahocevar/3072/lib/OpenLayers/Handler/Point.js
sandbox/ahocevar/3072/lib/OpenLayers/Handler/Polygon.js
sandbox/ahocevar/3072/tests/Handler/Polygon.html
Log:
doc and test improvements
Modified: sandbox/ahocevar/3072/lib/OpenLayers/Handler/Path.js
===================================================================
--- sandbox/ahocevar/3072/lib/OpenLayers/Handler/Path.js 2011-02-27 13:59:09 UTC (rev 11561)
+++ sandbox/ahocevar/3072/lib/OpenLayers/Handler/Path.js 2011-02-27 14:54:33 UTC (rev 11562)
@@ -298,7 +298,7 @@
},
/**
- * APIMethod: finishGeometry
+ * Method: finishTouchGeometry
* Finish the geometry and send it back to the control.
*/
finishTouchGeometry: function() {
Modified: sandbox/ahocevar/3072/lib/OpenLayers/Handler/Point.js
===================================================================
--- sandbox/ahocevar/3072/lib/OpenLayers/Handler/Point.js 2011-02-27 13:59:09 UTC (rev 11561)
+++ sandbox/ahocevar/3072/lib/OpenLayers/Handler/Point.js 2011-02-27 14:54:33 UTC (rev 11562)
@@ -257,7 +257,7 @@
},
/**
- * APIMethod: finishGeometry
+ * Method: finishTouchGeometry
* Finish the geometry and send it back to the control.
*/
finishTouchGeometry: function() {
@@ -421,6 +421,8 @@
if (this.timerId &&
this.passesTolerance(last, evt.xy, this.dblclickTolerance)) {
this.isDblclick = true;
+ // a valid touch immediately adds a component and leaves us with a
+ // complete geometry
this.finishTouchGeometry();
window.clearTimeout(this.timerId);
this.timerId = null;
Modified: sandbox/ahocevar/3072/lib/OpenLayers/Handler/Polygon.js
===================================================================
--- sandbox/ahocevar/3072/lib/OpenLayers/Handler/Polygon.js 2011-02-27 13:59:09 UTC (rev 11561)
+++ sandbox/ahocevar/3072/lib/OpenLayers/Handler/Polygon.js 2011-02-27 14:54:33 UTC (rev 11562)
@@ -150,7 +150,7 @@
},
/**
- * APIMethod: finishGeometry
+ * Method: finishTouchGeometry
* Finish the geometry and send it back to the control.
*/
finishTouchGeometry: function() {
Modified: sandbox/ahocevar/3072/tests/Handler/Polygon.html
===================================================================
--- sandbox/ahocevar/3072/tests/Handler/Polygon.html 2011-02-27 13:59:09 UTC (rev 11561)
+++ sandbox/ahocevar/3072/tests/Handler/Polygon.html 2011-02-27 14:54:33 UTC (rev 11562)
@@ -880,7 +880,7 @@
function test_sequence_touch_1(t) {
- t.plan(17);
+ t.plan(19);
log = [];
var map = new OpenLayers.Map("map", { // 300 x 150
@@ -902,36 +902,38 @@
map.addControl(control);
map.setCenter(new OpenLayers.LonLat(0, 0), 5);
handler.activate();
-
+
handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(49, 75)});
t.eq(log.length, 0, "touch start 1");
+ var expectedRing = new OpenLayers.Geometry.LinearRing([
+ new OpenLayers.Geometry.Point(-100, 0),
+ new OpenLayers.Geometry.Point(-100, 0)
+ ]);
handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(50, 75)});
t.eq(log.length, 0, "touch move");
-
+
handler.touchend({type: "touchend"});
t.eq(log.length, 0, "touch end");
- /*t.geom_eq(handler.polygon.geometry,
- new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([
- new OpenLayers.Geometry.Point(-100, 0),
- new OpenLayers.Geometry.Point(-100, 0),
- new OpenLayers.Geometry.Point(-100, 0)
- ])]), "geometry is correct");*/
+ expectedRing.addComponent(new OpenLayers.Geometry.Point(-100,0), 1);
+ t.geom_eq(handler.polygon.geometry.components[0], expectedRing, "geometry is correct");
+
handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(100, 75)});
t.eq(log.length, 0, "touch start 2");
+ var expectedRing = new OpenLayers.Geometry.LinearRing([
+ new OpenLayers.Geometry.Point(-100, 0),
+ new OpenLayers.Geometry.Point(-100, 0)
+ ]);
handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(250, 75)});
t.eq(log.length, 0, "touch move");
handler.touchend({type: "touchend"});
t.eq(log.length, 0, "touch end");
- /*t.geom_eq(handler.polygon.geometry,
- new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([
- new OpenLayers.Geometry.Point(-100, 0),
- new OpenLayers.Geometry.Point(-100, 0),
- new OpenLayers.Geometry.Point(-100, 0)
- ])]), "geometry is correct");*/
+ expectedRing.addComponent(new OpenLayers.Geometry.Point(-100,0), 1);
+
+ t.geom_eq(handler.polygon.geometry.components[0], expectedRing, "geometry is correct");
handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(100, 75)});
t.eq(log.length, 0, "touch start 3");
More information about the Commits
mailing list