Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24425] Ti.Map: Add touchEnabled to PolylineProxy to improve click-performance

GitHub Issuen/a
TypeImprovement
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-05-22T11:40:09.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.2.0
ComponentsAndroid, iOS
Labelsandroid, ios, map, performance
ReporterMichael Gangolf
AssigneeHans Knöchel
Created2017-02-21T13:06:22.000+0000
Updated2017-06-29T18:14:43.000+0000

Description

When adding a Polyline with 1370 points to the map my app freezes and will show the "not responding - wait or kill" message when you click on an empty map field (not on annotation). Responsible is this part: https://github.com/appcelerator-modules/ti.map/blob/master/android/src/ti/map/TiUIMapView.java#L834 That will check all lines/points which takes a long time. Since I don't want the line to be clickable at all it would be good to have a "touchEnabled()" parameter for a Polyline to skip the check. Removing the polyline will result in an instant click response! Device: Samsung Galaxy S 4mini Ti.Map: Version 3.1.0 Demo:
var win1 = Titanium.UI.createWindow({
    title: 'Map',
    backgroundColor: '#fff'
});

var Map = require('ti.map');
var mapview = Map.createView({
});

var p = []
for (var i = 0; i < 1000; ++i) {
    p.push({
        "longitude": Math.random()*10 + 2,
        "latitude": Math.random()*10 + 45
    });
}

var polyline = Map.createPolyline({
    points: p,
    touchEnabled: false,
    strokeWidth: 5,
    strokeColor: '#f00'
});
mapview.addPolyline(polyline);

win1.add(mapview);

mapview.addEventListener("click", function(e) {
    console.log(e.source);
});
win1.open();

Comments

  1. Michael Gangolf 2017-02-21

    PR: https://github.com/appcelerator-modules/ti.map/pull/199 Changing touchEnabled to true will freeze the app when you click on the map. With false it is still usable and you can click everywhere
  2. Sharif AbuDarda 2017-02-22

    Thanks for submitting the request. Our engineers will consider it.
  3. Hans Knöchel 2017-03-01

    Left some early review comments and set [~gmathews] as the reviewer.
  4. Hans Knöchel 2017-05-08

    Implemented iOS for parity as well, we also decided to use the check for all overlays (polygons, polylines & circles).
  5. Lokesh Choudhary 2017-06-29

    Verified the fix with map module 3.1.2 for Android & 2.10.0 for IOS. The property touchEnabled works as expected when used for polyline, circle & polygon. Closing. Studio Ver: 4.9.0.201705302345 SDK Ver: 6.1.1.GA OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.9 Appc CLI: 6.2.2 Ti CLI Ver: 5.0.14 Alloy Ver: 1.9.11 Node Ver: 6.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 5 --- Android 6.0.1 ⇨ google Pixel --- Android 7.1.1 Simulator: IOS 10.3.1 iphone 7

JSON Source