Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

mapView events don't work

Hi. I have noticed than only regionChanged event fired while moving the mapview. There are no click, singletap, focus events available.This is very annoying because i cannot hide (blur) search control while touching the mapview like in Google maps.app. How can I determine the latitude/longitude of the point I touched on the mapview? (without using annotation)

— asked April 28th 2010 by Vitali Virulaine
  • mapview
0 Comments

6 Answers

  • Got the same problem. I have a mapview and want to attach 'click' even handler - nothing is firing. What is the story here?

    — answered September 18th 2011 by Matthew Delmarter
    permalink
    0 Comments
  • Has any solution been found? I am having the same problem. The region changed event works and the click event for an annotation works, but clicking the mapview does not fire any events. By the way, I am on Android, and I tested this on 1.7.5

    — answered November 12th 2011 by David Riggleman
    permalink
    0 Comments
  • Same issue here. The only event that gets fired is the 'click' event. None of the others below are getting handled. I need to be able to add an annotation at the point where a user taps a map.

    mapview.addEventListener('click', function(e) {
        alert('click!');    
        if (e.annotation && (e.clicksource === 'leftButton' || e.clicksource == 'leftPane')) {      
            mapview.removeAnnotation(e.annotation);
        }         
    });
    mapview.addEventListener('dblclick', function(e) {
        alert('dblclick');    
    });
    mapview.addEventListener('doubletap', function(e) {
        alert('doubletap');    
    });
    mapview.addEventListener('singletap', function(e) {
        alert('singletap');    
    });        
    mapview.addEventListener('longpress', function(e) {
        alert('longpress');    
    });
    
    — answered May 9th 2012 by Ben Gustafson
    permalink
    0 Comments
  • i have a View (A) contains a webView (B) wich url property point to html file.

    when addEventListener to A (dblclick, doubletap, or even click),

    B's event are not fired :(

    — answered July 12th 2012 by Quang Pham
    permalink
    0 Comments
  • i'm seeing the same problem… it sucks that this issue is not fixed after more than a year :(

    — answered September 15th 2011 by Shouguo Li
    permalink
    0 Comments
  • I also faced the same problem, but resolved through following code :

    mapview.addEventListener('regionChanged',function(evt){
    alert(evt.latitude.toPrecision(10));
    alert(evt.latitude.toPrecision(10));`
    });

    Hope it helps you !!

    — answered October 5th 2011 by shraddha sheth
    permalink
    1 Comment
    • yes it works

      — commented February 21st 2012 by taewan hwang
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.