fix: setPov()
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.3.0-beta-201800509-1823" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
+<plugin id="cordova-plugin-googlemaps" version="2.3.0-beta-201800509-1906" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>cordova-plugin-googlemaps</name>
<js-module name="BaseClass" src="www/BaseClass.js">
<runs />
@@ -258,7 +258,7 @@ The native map view is faster, use less network usage, display 3D views, and eve
You need to specify this version number for all other plugins that use google play services sdk.
https://developers.google.com/android/guides/releases
-->
- <preference name="PLAY_SERVICES_VERSION" default="12.0.1" />
+ <preference name="PLAY_SERVICES_VERSION" default="15.0.1" />
<framework src="com.google.android.gms:play-services-maps:$PLAY_SERVICES_VERSION" />
<framework src="com.google.android.gms:play-services-location:$PLAY_SERVICES_VERSION" />

MODIFY
src/android/plugin/google/maps/PluginStreetViewPanorama.java
src/android/plugin/google/maps/PluginStreetViewPanorama.java
@@ -313,19 +313,21 @@ public class PluginStreetViewPanorama extends MyPlugin implements
try {
final JSONObject cameraPosition = args.getJSONObject(0);
- if (cameraPosition.has("bearing") || cameraPosition.has("tilt")) {
StreetViewPanoramaCamera currentCamera = panorama.getPanoramaCamera();
float bearing = cameraPosition.has("bearing") ? (float) cameraPosition.getDouble("bearing") : currentCamera.bearing;
float tilt = cameraPosition.has("tilt") ? (float) cameraPosition.getDouble("tilt") : currentCamera.tilt;
float zoom = cameraPosition.has("zoom") ? (float) cameraPosition.getDouble("zoom") : currentCamera.zoom;
- long duration = cameraPosition.has("duration") ? (long) cameraPosition.getDouble("duration") : 0;
+ long duration = cameraPosition.has("duration") ? (long) cameraPosition.getDouble("duration") : 1000;
- StreetViewPanoramaCamera newCamera = new StreetViewPanoramaCamera(bearing, tilt, zoom);
+ StreetViewPanoramaCamera newCamera = new StreetViewPanoramaCamera.Builder()
+ .bearing(bearing)
+ .zoom(zoom)
+ .tilt(tilt)
+ .build();
panorama.animateTo(newCamera, duration);
- }
callbackContext.success();
- } catch (JSONException e) {
+ } catch (Exception e) {
e.printStackTrace();
callbackContext.error("" + e.getMessage());
}

MODIFY
www/StreetViewPanorama.js
www/StreetViewPanorama.js
@@ -20,6 +20,9 @@ var StreetViewPanorama = function(streetViewId, _exec) {
self.set("gesture_zoom", true);
self.set("control_navigation", true);
self.set("control_streetNames", true);
+ self.set("camera_zoom", 0);
+ self.set("camera_tilt", 0);
+ self.set("camera_bearing", 0);
//-----------------------------------------------
// Sets event listeners
@@ -229,26 +232,20 @@ StreetViewPanorama.prototype.setPosition = function(cameraPosition, callback) {
StreetViewPanorama.prototype.setPov = function(pov, callback) {
var self = this;
pov = pov || {};
- if ("zoom" in cameraPosition) {
- self.set("camera_zoom", cameraPosition.zoom);
- } else {
- pov.zoom = self.get("camera_zoom");
+ if ("zoom" in pov) {
+ self.set("camera_zoom", pov.zoom);
}
- if ("bearing" in cameraPosition) {
- self.set("camera_bearing", cameraPosition.bearing);
- } else {
- pov.bearing = self.get("camera_bearing");
+ if ("bearing" in pov) {
+ self.set("camera_bearing", pov.bearing);
}
- if ("tilt" in cameraPosition) {
- self.set("camera_tilt", cameraPosition.tilt);
- } else {
- pov.tilt = self.get("camera_tilt");
+ if ("tilt" in pov) {
+ self.set("camera_tilt", pov.tilt);
}
self.exec.call(self, function() {
if (typeof callback === "function") {
callback.call(self);
}
- }, self.errorHandler, self.id, 'setPov', [cameraPosition], {
+ }, self.errorHandler, self.id, 'setPov', [pov], {
sync: true
});
return this;

fix: setPov()