Summary
The iOS version of "ti.map" module's
View
type has a
zoom()
method that is missing on Android. We should add this
View.zoom()
method for parity.
The module's docs do not indicate that the
zoom()
function is Android only. This suggests that it's cross-platform, which is wrong.
Work-Around
Currently, the only method that supports zooming on Android and iOS is
View.setLocation()
via its "latitudeDelta" and "longitudeDelta" settings.
Steps to reproduce:
1. Use the code below in your app.js:
var MapModule = require('ti.map');
var win = Ti.UI.createWindow({fullscreen: false, layout: "vertical"});
var map = MapModule.createView({
enableZoomControls: false,
mapType: MapModule.NORMAL_TYPE,
animate: true,
});
var b4 = Ti.UI.createButton({
title: "Zoom in/out"
});
var zoomLevel = 1;
b4.addEventListener('click', function(){
map.zoom(zoomLevel);
zoomLevel = -zoomLevel;
});
win.add(b4);
win.add(map);
win.open();
2. Setup your app for using android map module.
3. Build for device/emulator.
4. After the app launches tap on
ZOOM IN/OUT
.
This is a parity issue. iOS has a
zoom()
method, but Android does not. The map module's docs are wrong. The only way to zoom on both platforms is via thesetLocation()
method.PR: https://github.com/appcelerator-modules/ti.map/pull/291
[~jquick]: can you kindly review this PR: https://github.com/appcelerator-modules/ti.map/pull/291
Verified on below environment: *Mac OS X*= 10.15 *Node.js Version* = 12.16.0 *CLI Version* = 5.2.2 *SDK Version* = 9.1.0.v20200514121733 *ti.map version* = 5.0.2 (Android) *Emulator*: Nexus6_API27 (SDK API: 29) Working fine so closing this ticket. (Attached log and screenshots for reference) And merging above PR to master