Titanium JIRA Archive
Appcelerator Modules (MOD)

[MOD-2559] Android: Add "ti.map" View.zoom() method

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2020-05-20T07:42:23.000+0000
Affected Version/sn/a
Fix Version/sRelease 9.2.0
ComponentsMap
Labels2020-Q3, android, map, module, parity, zoom
ReporterLokesh Choudhary
AssigneeAakash Jain
Created2019-12-11T18:29:48.000+0000
Updated2020-07-27T08:48:49.000+0000

Description

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.

Attachments

FileDateSize
MOD-2559_log.txt2020-05-20T07:41:57.000+000073010
MOD-2559_Screenshot_1.png2020-05-20T07:42:02.000+0000459049
MOD-2559_Screenshot_2.png2020-05-20T07:42:04.000+0000605353

Comments

  1. Joshua Quick 2020-03-17

    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 the setLocation() method.
  2. Aakash Jain 2020-04-09

    PR: https://github.com/appcelerator-modules/ti.map/pull/291
  3. Aakash Jain 2020-04-17

    [~jquick]: can you kindly review this PR: https://github.com/appcelerator-modules/ti.map/pull/291
  4. Saumya Rai 2020-05-20

    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

JSON Source