Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23343] Windows : Map annotations do not handle click events

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-05-31T15:52:05.000+0000
Affected Version/sRelease 5.3.0
Fix Version/sRelease 5.4.0
ComponentsWindows
Labelsqe-5.4.0
ReporterJörgen Buder
AssigneeKota Iguchi
Created2016-05-09T14:01:34.000+0000
Updated2016-06-23T19:57:57.000+0000

Description

Windows has support for the map namespace and according to API parity and looking at the code in the github repo almost all APIs are in, one thing we can´t get working is the annotation (or map) click event, there is in fact a click event, but the event is not returning and useful data, we do not know the e.source for instance or some similar data sp we can parse it and use it to know which annotation was clicked... Can we expose the annotation some how so we can know what annotation was clicked by attaching to the proxy object and add a native handler?

Comments

  1. Jörgen Buder 2016-05-17

    Hi We need your attention to this issue, here is more information. Setting up a map i the standard way adding annotation to it and then trying to print the object from the annotation click looks like this:
       [INFO] :   Print all event info from map:
       [INFO] e.clicksource: undefined, e.title: undefined, e.annotation: undefined, latitude: undefined, e.longitude: undefined, e.source: [object class TitaniumWindows::Map::View], e.type: click
       [INFO] :   Background Count : 0
       
    As you can see there is no way for us to determine what the source was, and generally we are not able to parse the object coming into the function it crashes the parsing. Code:
       mapview.addEventListener('click', function(e) {
       
           
           Alloy.Globals.logger.info('Print all event info from map:');
           Alloy.Globals.logger.info('e.clicksource: ' + e.clicksource + ', e.title: ' + e.title +
                       ', e.annotation: ' + e.annotation + ', latitude: ' + e.latitude +
                       ', e.longitude: ' + e.longitude + ', e.source: ' + e.source + 
                       ', e.type: ' + e.type + '\n');
           // make the annotation respond to click events anywhere in the view for Android
           // and for the left button click on iOS
       
           // Check if anything beside My Position is clicked
           if (e.clicksource == 'pin' && e.annotation.annotationType != "myPos") {
               // Check if address is available, otherwise reverse geocode
               if (!e.annotation.address) {
                   getAddress(e.annotation);
               }
           }
           else if ((e.clicksource == 'leftPane') || (e.clicksource == 'rightButton')
           			|| (e.clicksource == 'rightPane') || ((e.clicksource == 'rightView'))
           			|| (e.clicksource == 'infoWindow') || (e.clicksource == 'title'))
           {
               if (myPosition !== e.annotation) {
                   Titanium.Analytics.featureEvent('app.feature.mapannotationopen');
       
                   e.annotation.parentView = parentView;
                   var annotationWidget = Alloy.createWidget('mapannotation', e.annotation);
                   var annotationView = annotationWidget.getView();
                   parentView.add(annotationView);
               }
           }
       
  2. Jörgen Buder 2016-05-27

    Am I clear enough in this ticket? Let me know if you need me to test something or add information to this quite important ticket. Thanks
  3. Kota Iguchi 2016-05-27

    https://github.com/appcelerator/titanium_mobile_windows/pull/723
  4. Josh Longton 2016-06-23

    Verified as fixed. Tested on: Microsoft Lumia 640 (8.1) Windows Simulator (8.1) Microsoft Lumia 640 (10) Windows Simulator (10) Windows 10 Pro Studio: 4.7.0.201606150733 Ti SDK: 5.4.0.v20160617074028 Appc NPM: 4.2.7-2 App CLI: 5.4.0-18 Node v4.4.4 *Closing Ticket.*

JSON Source