Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-28529

Android: Update "ti.map" module to support "camera" property and animateCamera()

    Details

    • Story Points:
      7

      Description

      Summary:
      iOS' version of the "ti.map" modules supports the ability to control the height, pitch, and rotation of the camera via the following APIs. We should add the same on Android.

      Implementation:
      A community written PR has been made to do this by Michael Gangolf. (Thanks!)
      https://github.com/appcelerator-modules/ti.map/pull/451

      Animate Camera Test:
      This smoothly animates the camera to 2 different positions.

      const Map = require('ti.map');
      const window = Titanium.UI.createWindow();
      const mapview = Map.createView({
      	mapType: Map.NORMAL_TYPE,
      	animate: false,
      	regionFit: true
      });
      window.add(mapview);
      window.addEventListener('open', () => {
      	setTimeout(() => {
      		const camera = Map.createCamera({
      			altitude: 15.5,
      			centerCoordinates: { longitude: 151.276417, latitude: -33.891614 },
      			heading: -90,
      			pitch: 75
      		});
      		mapview.animateCamera({ camera: camera, duration: 5000 }, () => {
      			setTimeout(() => {
      				camera.centerCoordinates = { longitude: 151.20689, latitude: -33.87365 };
      				camera.heading = 90;
      				camera.pitch = 50;
      				mapview.animateCamera({ camera: camera });
      			}, 2000);
      		});
      	}, 2000);
      });
      window.open();
      

      Camera Property Test:
      This instantly moves the camera (without animation) to 2 different locations.

      var Map = require('ti.map');
      var win = Titanium.UI.createWindow();
       
      var mapview = Map.createView({
      	mapType: Map.NORMAL_TYPE,
      	animate: false,
      	regionFit: true
      });
       
      var camera = Map.createCamera({
      	altitude: 15.5,
      	centerCoordinates: {
      		longitude: 151.276417,
      		latitude: -33.891614
      	},
      	heading: -90,
      	pitch: 75
      });
       
       
      setTimeout(function() {
      	mapview.camera = camera;
       
      	camera.centerCoordinates = {
      		longitude: 151.20689,
      		latitude: -33.87365
      	};
      	camera.heading = 90;
      	camera.pitch = 50;
      	setTimeout(function() {
      		mapview.camera = camera;
      	}, 6000)
      }, 2000)
      win.add(mapview);
      win.open();
      

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              jquick Joshua Quick
              Reviewer:
              Joshua Quick
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration