[OpenLayers-Commits] r11943 - in trunk/openlayers:
lib/OpenLayers/Handler tests/Handler
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Tue May 3 10:09:10 EDT 2011
Author: erilem
Date: 2011-05-03 07:09:09 -0700 (Tue, 03 May 2011)
New Revision: 11943
Modified:
trunk/openlayers/lib/OpenLayers/Handler/Feature.js
trunk/openlayers/tests/Handler/Feature.html
Log:
Handler.Feature may not trigger click when touching a feature, r=sbrunner
Modified: trunk/openlayers/lib/OpenLayers/Handler/Feature.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Handler/Feature.js 2011-05-03 10:08:42 UTC (rev 11942)
+++ trunk/openlayers/lib/OpenLayers/Handler/Feature.js 2011-05-03 14:09:09 UTC (rev 11943)
@@ -271,7 +271,7 @@
var type = evt.type;
var handled = false;
var previouslyIn = !!(this.feature); // previously in a feature
- var click = (type == "click" || type == "dblclick");
+ var click = (type == "click" || type == "dblclick" || type == "touchstart");
this.feature = this.layer.getFeatureFromEvent(evt);
if(this.feature && !this.feature.layer) {
// feature has been destroyed
@@ -282,7 +282,7 @@
this.lastFeature = null;
}
if(this.feature) {
- if(evt.type === "touchstart") {
+ if(type === "touchstart") {
// stop the event to prevent Android Webkit from
// "flashing" the map div
OpenLayers.Event.stop(evt);
Modified: trunk/openlayers/tests/Handler/Feature.html
===================================================================
--- trunk/openlayers/tests/Handler/Feature.html 2011-05-03 10:08:42 UTC (rev 11942)
+++ trunk/openlayers/tests/Handler/Feature.html 2011-05-03 14:09:09 UTC (rev 11943)
@@ -123,7 +123,7 @@
}
function test_callbacks(t) {
- t.plan(13);
+ t.plan(14);
var map = new OpenLayers.Map('map', {controls: []});
var control = new OpenLayers.Control();
@@ -235,6 +235,12 @@
evtPx.type = "touchstart";
map.events.triggerEvent('touchstart', evtPx);
+ // test touchstart on the same feature
+ // 'click' callback should be called
+ callbacks['click'] = getCallback('click (touch)', newFeature);
+ evtPx.type = "touchstart";
+ map.events.triggerEvent('touchstart', evtPx);
+
// test touchstart in new feature and out of last feature
// both 'click' and 'clickout' callbacks should be called
lastFeature = newFeature;
More information about the Commits
mailing list