Prevent error: TypeError: Cannot read property 'lat' of undefined
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.1.2-beta-20171106-1121" 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.1.2-beta-20171107-1605" 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 />

MODIFY
www/Circle.js
www/Circle.js
@@ -43,28 +43,36 @@ var Circle = function(map, circleId, circleOptions, _exec) {
//-----------------------------------------------
// Sets event listeners
//-----------------------------------------------
- self.on("center_changed", function(oldValue, center) {
+ self.on("center_changed", function() {
+ var center = self.get("center");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setCenter', [self.getId(), center.lat, center.lng]);
});
- self.on("fillColor_changed", function(oldValue, color) {
+ self.on("fillColor_changed", function() {
+ var color = self.get("fillColor");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setFillColor', [self.getId(), common.HTMLColor2RGBA(color, 0.75)]);
});
- self.on("strokeColor_changed", function(oldValue, color) {
+ self.on("strokeColor_changed", function() {
+ var color = self.get("strokeColor");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setStrokeColor', [self.getId(), common.HTMLColor2RGBA(color, 0.75)]);
});
- self.on("strokeWidth_changed", function(oldValue, width) {
+ self.on("strokeWidth_changed", function() {
+ var width = self.get("strokeWidth");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setStrokeWidth', [self.getId(), width]);
});
- self.on("clickable_changed", function(oldValue, clickable) {
+ self.on("clickable_changed", function() {
+ var clickable = self.get("clickable");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setClickable', [self.getId(), clickable]);
});
- self.on("radius_changed", function(oldValue, radius) {
+ self.on("radius_changed", function() {
+ var radius = self.get("radius");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setRadius', [self.getId(), radius]);
});
- self.on("zIndex_changed", function(oldValue, zIndex) {
+ self.on("zIndex_changed", function() {
+ var zIndex = self.get("zIndex");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setZIndex', [self.getId(), zIndex]);
});
- self.on("visible_changed", function(oldValue, visible) {
+ self.on("visible_changed", function() {
+ var visible = self.get("visible");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setVisible', [self.getId(), visible]);
});

MODIFY
www/GroundOverlay.js
www/GroundOverlay.js
@@ -44,25 +44,32 @@ var GroundOverlay = function(map, groundOverlayId, groundOverlayOptions, _exec)
//-----------------------------------------------
// Sets event listeners
//-----------------------------------------------
- self.on("visible_changed", function(oldValue, visible) {
+ self.on("visible_changed", function() {
+ var visible = self.get("visible");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setVisible', [self.getId(), visible]);
});
- self.on("image_changed", function(oldValue, url) {
- exec.call(self, null, self.errorHandler, self.getPluginName(), 'setImage', [self.getId(), url]);
+ self.on("image_changed", function() {
+ var image = self.get("image");
+ exec.call(self, null, self.errorHandler, self.getPluginName(), 'setImage', [self.getId(), image]);
});
- self.on("bounds_changed", function(oldValue, bounds) {
+ self.on("bounds_changed", function() {
+ var bounds = self.get("bounds");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setBounds', [self.getId(), bounds]);
});
- self.on("opacity_changed", function(oldValue, opacity) {
+ self.on("opacity_changed", function() {
+ var opacity = self.get("opacity");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setOpacity', [self.getId(), opacity]);
});
- self.on("clickable_changed", function(oldValue, clickable) {
+ self.on("clickable_changed", function() {
+ var clickable = self.get("clickable");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setClickable', [self.getId(), clickable]);
});
- self.on("bearing_changed", function(oldValue, bearing) {
+ self.on("bearing_changed", function() {
+ var bearing = self.get("bearing");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setBearing', [self.getId(), bearing]);
});
- self.on("zIndex_changed", function(oldValue, zIndex) {
+ self.on("zIndex_changed", function() {
+ var zIndex = self.get("zIndex");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setZIndex', [self.getId(), zIndex]);
});

MODIFY
www/Marker.js
www/Marker.js
@@ -61,43 +61,56 @@ var Marker = function(map, id, markerOptions, className, _exec) {
self.showInfoWindow.apply(self);
});
- self.on("position_changed", function(oldValue, position) {
+ self.on("position_changed", function() {
+ var position = self.get("position");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setPosition', [self.getId(), position.lat, position.lng]);
});
- self.on("rotation_changed", function(oldValue, rotation) {
+ self.on("rotation_changed", function() {
+ var rotation = self.get("rotation");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setRotation', [self.getId(), rotation]);
});
- self.on("snippet_changed", function(oldValue, snippet) {
+ self.on("snippet_changed", function() {
+ var snippet = self.get("snippet");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setSnippet', [self.getId(), snippet]);
});
- self.on("visible_changed", function(oldValue, visible) {
+ self.on("visible_changed", function() {
+ var visible = self.get("visible");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setVisible', [self.getId(), visible]);
});
- self.on("title_changed", function(oldValue, title) {
+ self.on("title_changed", function() {
+ var title = self.get("title");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setTitle', [self.getId(), title]);
});
- self.on("icon_changed", function(oldValue, url) {
- exec.call(self, null, self.errorHandler, self.getPluginName(), 'setIcon', [self.getId(), url]);
+ self.on("icon_changed", function() {
+ var icon = self.get("icon");
+ exec.call(self, null, self.errorHandler, self.getPluginName(), 'setIcon', [self.getId(), icon]);
});
- self.on("flat_changed", function(oldValue, flat) {
+ self.on("flat_changed", function() {
+ var flat = self.get("flat");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setFlat', [self.getId(), flat]);
});
- self.on("draggable_changed", function(oldValue, draggable) {
+ self.on("draggable_changed", function() {
+ var draggable = self.get("draggable");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setDraggable', [self.getId(), draggable]);
});
- self.on("anchor_changed", function(oldValue, anchor) {
+ self.on("anchor_changed", function() {
+ var anchor = self.get("anchor");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setIconAnchor', [self.getId(), anchor[0], anchor[1]]);
});
- self.on("infoWindowAnchor_changed", function(oldValue, anchor) {
+ self.on("infoWindowAnchor_changed", function() {
+ var anchor = self.get("infoWindowAnchor");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setInfoWindowAnchor', [self.getId(), anchor[0], anchor[1]]);
});
- self.on("zIndex_changed", function(oldValue, zIndex) {
+ self.on("zIndex_changed", function() {
+ var zIndex = self.get("zIndex");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setZIndex', [self.getId(), zIndex]);
});
- self.on("opacity_changed", function(oldValue, opacity) {
+ self.on("opacity_changed", function() {
+ var opacity = self.get("opacity");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setOpacity', [self.getId(), opacity]);
});
- self.on("disableAutoPan_changed", function(oldValue, disableAutoPan) {
+ self.on("disableAutoPan_changed", function() {
+ var disableAutoPan = self.get("disableAutoPan");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setDisableAutoPan', [self.getId(), disableAutoPan]);
});

MODIFY
www/Polygon.js
www/Polygon.js
@@ -100,25 +100,32 @@ var Polygon = function(map, polygonId, polygonOptions, _exec) {
//-----------------------------------------------
// Sets event listeners
//-----------------------------------------------
- self.on("clickable_changed", function(oldValue, clickable) {
+ self.on("clickable_changed", function() {
+ var clickable = self.get("clickable");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setClickable', [self.getId(), clickable]);
});
- self.on("geodesic_changed", function(oldValue, geodesic) {
+ self.on("geodesic_changed", function() {
+ var geodesic = self.get("geodesic");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setGeodesic', [self.getId(), geodesic]);
});
- self.on("zIndex_changed", function(oldValue, zIndex) {
+ self.on("zIndex_changed", function() {
+ var zIndex = self.get("zIndex");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setZIndex', [self.getId(), zIndex]);
});
- self.on("visible_changed", function(oldValue, visible) {
+ self.on("visible_changed", function() {
+ var visible = self.get("visible");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setVisible', [self.getId(), visible]);
});
- self.on("strokeWidth_changed", function(oldValue, width) {
+ self.on("strokeWidth_changed", function() {
+ var width = self.get("strokeWidth");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setStrokeWidth', [self.getId(), width]);
});
- self.on("strokeColor_changed", function(oldValue, color) {
+ self.on("strokeColor_changed", function() {
+ var color = self.get("strokeColor");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setStrokeColor', [self.getId(), common.HTMLColor2RGBA(color, 0.75)]);
});
- self.on("fillColor_changed", function(oldValue, color) {
+ self.on("fillColor_changed", function() {
+ var color = self.get("fillColor");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setFillColor', [self.getId(), common.HTMLColor2RGBA(color, 0.75)]);
});

MODIFY
www/Polyline.js
www/Polyline.js
@@ -60,22 +60,28 @@ var Polyline = function(map, polylineId, polylineOptions, _exec) {
//-----------------------------------------------
// Sets event listeners
//-----------------------------------------------
- self.on("geodesic_changed", function(oldValue, geodesic) {
+ self.on("geodesic_changed", function() {
+ var geodesic = self.get("geodesic");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setGeodesic', [self.getId(), geodesic]);
});
- self.on("zIndex_changed", function(oldValue, zIndex) {
+ self.on("zIndex_changed", function() {
+ var zIndex = self.get("zIndex");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setZIndex', [self.getId(), zIndex]);
});
- self.on("clickable_changed", function(oldValue, clickable) {
+ self.on("clickable_changed", function() {
+ var clickable = self.get("clickable");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setClickable', [self.getId(), clickable]);
});
- self.on("visible_changed", function(oldValue, visible) {
+ self.on("visible_changed", function() {
+ var visible = self.get("visible");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setVisible', [self.getId(), visible]);
});
- self.on("strokeWidth_changed", function(oldValue, width) {
- exec.call(self, null, self.errorHandler, self.getPluginName(), 'setStrokeWidth', [self.getId(), width]);
+ self.on("strokeWidth_changed", function() {
+ var strokeWidth = self.get("strokeWidth");
+ exec.call(self, null, self.errorHandler, self.getPluginName(), 'setStrokeWidth', [self.getId(), strokeWidth]);
});
- self.on("strokeColor_changed", function(oldValue, color) {
+ self.on("strokeColor_changed", function() {
+ var color = self.get("strokeColor");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setStrokeColor', [self.getId(), common.HTMLColor2RGBA(color, 0.75)]);
});

MODIFY
www/TileOverlay.js
www/TileOverlay.js
@@ -41,16 +41,20 @@ var TileOverlay = function(map, tileOverlayId, tileOverlayOptions, _exec) {
//-----------------------------------------------
// Sets event listeners
//-----------------------------------------------
- self.on("fadeIn_changed", function(oldValue, fadeIn) {
+ self.on("fadeIn_changed", function() {
+ var fadeIn = self.get("fadeIn");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setFadeIn', [self.getId(), fadeIn]);
});
- self.on("opacity_changed", function(oldValue, opacity) {
+ self.on("opacity_changed", function() {
+ var opacity = self.get("opacity");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setOpacity', [self.getId(), opacity]);
});
- self.on("zIndex_changed", function(oldValue, zIndex) {
+ self.on("zIndex_changed", function() {
+ var zIndex = self.get("zIndex");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setZIndex', [self.getId(), zIndex]);
});
- self.on("visible_changed", function(oldValue, visible) {
+ self.on("visible_changed", function() {
+ var visible = self.get("visible");
exec.call(self, null, self.errorHandler, self.getPluginName(), 'setVisible', [self.getId(), visible]);
});
};

Prevent error: TypeError: Cannot read property 'lat' of undefined