[TIMOB-24425] Ti.Map: Add touchEnabled to PolylineProxy to improve click-performance
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-05-22T11:40:09.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 6.2.0 |
Components | Android, iOS |
Labels | android, ios, map, performance |
Reporter | Michael Gangolf |
Assignee | Hans Knöchel |
Created | 2017-02-21T13:06:22.000+0000 |
Updated | 2017-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();
PR: https://github.com/appcelerator-modules/ti.map/pull/199 Changing
touchEnabled
totrue
will freeze the app when you click on the map. Withfalse
it is still usable and you can click everywhereThanks for submitting the request. Our engineers will consider it.
Left some early review comments and set [~gmathews] as the reviewer.
Implemented iOS for parity as well, we also decided to use the check for all overlays (polygons, polylines & circles).
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