PDA

View Full Version : [FIXED] Google Maps Listener on click



stefx
5 Apr 2011, 5:55 AM
Sencha Touch version tested:

1.0.1 rev a
1.1.0


Platform tested against:

iOS 3
iOS 4.2
iOS 4.3.1
iOS 4.3.2


Description:

With the latest version of Google Maps Api (ver. 3.4), with "sencha-touch.js" just included (no functions actually called), the listener for the 'click' event, added to a google.marker, does not work: it never gets called.
Listeners to other types of event (e.g. 'double click') just work fine.
With older versions of Google Maps Api, i.e. 3.2 o less, the above bug does not reproduce.


Test Case:



<include "sencha-touch.js">
google.maps.event.addListener(gObject, "click", function(e){
alert('test');
});


See this URL : http://togo.055055.it/static/togo_mini_viewer_v3.4.html (Google Maps API V.3.4 - affected by the problem) and http://togo.055055.it/static/togo_mini_viewer_v3.2.html (Google Maps API V.3.2 - works properly).

stefx
10 Apr 2011, 10:31 PM
Any response?
stefano

mitchellsimoens
22 Apr 2011, 11:36 AM
You state that with the updated Maps it doesn't work so is it really a bug with Sencha Touch?

stefx
26 Apr 2011, 2:28 AM
To the best of our knowledge, yes. At the very least it seems that Sencha and Google Maps v3.4 interact in a way that causes malfunctioning.

Stefano

calinseciu
26 Apr 2011, 8:05 AM
This is a bug in the current version of Sencha Touch (1.1).
You can include the following code before your application code to make the on click event to work in Google Maps:


Ext.gesture.Manager.onMouseEventOld = Ext.gesture.Manager.onMouseEvent;
Ext.gesture.Manager.onMouseEvent = function(e) {
var target = e.target;

while (target) {
if (Ext.fly(target) && Ext.fly(target).hasCls('x-map')) {
return;
}

target = target.parentNode;
}

this.onMouseEventOld.apply(this, arguments);
};

This is a temporary fix until Sencha will fix the problem.

beetree
1 Sep 2011, 6:00 AM
Awesome. Fix works! Thanks a lot for sharing.

Please let us know when this fix is implemented in the lib so that I can reduce my ever-growing "fixes.js" :)

Jokes aside, keep up the awesome work Sencha!

BX69
2 Sep 2011, 2:15 PM
When I paste the code fix into my code... the map doesn't load. Any ideas?

mike.estes
2 Sep 2011, 2:27 PM
thanks for the report! @calinseciu thanks for posting your workaround, I'll get this fixed in the source

beetree
5 Sep 2011, 8:51 AM
When I paste the code fix into my code... the map doesn't load. Any ideas?

Make sure you paste it on the very top of your code. Does it load if you remove his fix?

won.rhee
7 Dec 2011, 2:06 PM
'mouseup' worked for me without using above fix.