[OpenLayers-Commits] r11948 - in trunk/openlayers:
lib/OpenLayers/Handler tests/Handler
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Wed May 4 06:37:13 EDT 2011
Author: erilem
Date: 2011-05-04 03:37:09 -0700 (Wed, 04 May 2011)
New Revision: 11948
Modified:
trunk/openlayers/lib/OpenLayers/Handler/Feature.js
trunk/openlayers/tests/Handler/Feature.html
Log:
make it so features are not selected if there are multiple touches in the touchstart event, r=bbinet (closes #3279)
Modified: trunk/openlayers/lib/OpenLayers/Handler/Feature.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Handler/Feature.js 2011-05-04 07:48:55 UTC (rev 11947)
+++ trunk/openlayers/lib/OpenLayers/Handler/Feature.js 2011-05-04 10:37:09 UTC (rev 11948)
@@ -147,7 +147,8 @@
scope: this
});
}
- return this.mousedown(evt);
+ return OpenLayers.Event.isMultiTouch(evt) ?
+ true : this.mousedown(evt);
},
/**
Modified: trunk/openlayers/tests/Handler/Feature.html
===================================================================
--- trunk/openlayers/tests/Handler/Feature.html 2011-05-04 07:48:55 UTC (rev 11947)
+++ trunk/openlayers/tests/Handler/Feature.html 2011-05-04 10:37:09 UTC (rev 11948)
@@ -588,6 +588,64 @@
t.eq(clicks, 0, "click callback does not trigger when tolerance is reached");
}
+ function test_multitouch_canvas(t) {
+ var supported = OpenLayers.Renderer.Canvas.prototype.supported();
+ if (!supported) { t.plan(0); return; }
+
+ t.plan(1);
+
+ // set up
+
+ var log;
+
+ var map = new OpenLayers.Map('map');
+ var layer = new OpenLayers.Layer.Vector('vectors', {
+ renderers: ['Canvas'],
+ isBaseLayer: true
+ });
+ map.addLayer(layer);
+
+ var control = new OpenLayers.Control();
+ var handler = new OpenLayers.Handler.Feature(control, layer,
+ {click: function() { log++; }});
+ control.handler = handler;
+ map.addControl(control);
+ control.activate();
+
+ var feature = new OpenLayers.Feature.Vector(
+ new OpenLayers.Geometry.Point(0, 0));
+ layer.addFeatures(feature);
+
+ map.zoomToMaxExtent();
+
+ // test
+
+ // mock getMousePosition on the events object to make
+ // sure scrolls, offsets and leftop do not interfere
+ map.events.getMousePosition = function(evt) {
+ return new OpenLayers.Pixel(evt.clientX,
+ evt.clientY);
+ };
+
+ log = 0;
+ var evt = {
+ type: 'touchstart',
+ touches: [{
+ clientX: 100,
+ clientY: 75
+ }, {
+ clientX: 200,
+ clientY: 75
+ }]
+ };
+ map.events.handleBrowserEvent(evt);
+ t.eq(log, 0, "no feature selection when multi-touching");
+
+ // tear down
+
+ map.destroy();
+ }
+
</script>
</head>
<body>
More information about the Commits
mailing list