Handler.Feature may not trigger click when touching a feature, r=sbrunner
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11943 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -271,7 +271,7 @@ OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
|
|||||||
var type = evt.type;
|
var type = evt.type;
|
||||||
var handled = false;
|
var handled = false;
|
||||||
var previouslyIn = !!(this.feature); // previously in a feature
|
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);
|
this.feature = this.layer.getFeatureFromEvent(evt);
|
||||||
if(this.feature && !this.feature.layer) {
|
if(this.feature && !this.feature.layer) {
|
||||||
// feature has been destroyed
|
// feature has been destroyed
|
||||||
@@ -282,7 +282,7 @@ OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
|
|||||||
this.lastFeature = null;
|
this.lastFeature = null;
|
||||||
}
|
}
|
||||||
if(this.feature) {
|
if(this.feature) {
|
||||||
if(evt.type === "touchstart") {
|
if(type === "touchstart") {
|
||||||
// stop the event to prevent Android Webkit from
|
// stop the event to prevent Android Webkit from
|
||||||
// "flashing" the map div
|
// "flashing" the map div
|
||||||
OpenLayers.Event.stop(evt);
|
OpenLayers.Event.stop(evt);
|
||||||
|
|||||||
@@ -123,7 +123,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_callbacks(t) {
|
function test_callbacks(t) {
|
||||||
t.plan(13);
|
t.plan(14);
|
||||||
|
|
||||||
var map = new OpenLayers.Map('map', {controls: []});
|
var map = new OpenLayers.Map('map', {controls: []});
|
||||||
var control = new OpenLayers.Control();
|
var control = new OpenLayers.Control();
|
||||||
@@ -235,6 +235,12 @@
|
|||||||
evtPx.type = "touchstart";
|
evtPx.type = "touchstart";
|
||||||
map.events.triggerEvent('touchstart', evtPx);
|
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
|
// test touchstart in new feature and out of last feature
|
||||||
// both 'click' and 'clickout' callbacks should be called
|
// both 'click' and 'clickout' callbacks should be called
|
||||||
lastFeature = newFeature;
|
lastFeature = newFeature;
|
||||||
|
|||||||
Reference in New Issue
Block a user