(Browser) Fix: Null pointer error in PluginMarker.js
(Browser) Fix: ClusterIcon anchor is incorrect.
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.4.4-beta-20180912-1906" 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.4.4-beta-20180913-1200" 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="Promise" src="www/Promise.js">
<runs/>

MODIFY
src/browser/PluginMarker.js
src/browser/PluginMarker.js
@@ -443,9 +443,11 @@ PluginMarker.prototype._showInfoWindow = function(marker) {
google.maps.event.addListenerOnce(self.infoWnd, 'domready', function() {
self.onMarkerClickEvent(event.INFO_OPEN, marker);
+ if (container.parentNode) {
google.maps.event.addDomListener(container.parentNode.parentNode.parentNode, 'click', function() {
self.onMarkerClickEvent(event.INFO_CLICK, marker);
}, true);
+ }
});
self.infoWnd.setOptions({

MODIFY
src/browser/PluginMarkerCluster.js
src/browser/PluginMarkerCluster.js
@@ -439,7 +439,6 @@ PluginMarkerCluster.prototype.remove = function(onSuccess, onError, args) {
PluginMarkerCluster.prototype.onClusterEvent = function(evtName, marker) {
var self = this,
mapId = self.pluginMap.id;
-
var overlayId = marker.get("overlayId");
var tmp = overlayId.split("-");
var clusterId = tmp[0];
@@ -518,12 +517,46 @@ function ClusterIconClass(options) {
iconMarker.bindTo('position', labelMarker);
iconMarker.bindTo('map', labelMarker);
self.bindTo('opacity', iconMarker);
- self.bindTo('icon', iconMarker);
self.bindTo('visible', iconMarker);
self.bindTo('map', iconMarker);
self.bindTo('position', iconMarker);
self.set('labelMarkerAnchor', new google.maps.Point(canvas.width / 2, canvas.height / 2));
+ self.addListener('icon_changed', function() {
+ var icon = self.get('icon');
+ if (typeof icon === "string") {
+ icon = {
+ "url": icon
+ };
+ }
+
+ var iconUrl = icon.url;
+ if (typeof icon === "object") {
+ if (typeof icon.size === "object" &&
+ icon.size.width && icon.size.height) {
+ icon.anchor = new google.maps.Point(icon.size.width / 2, icon.size.height / 2);
+ iconMarker.setIcon(icon);
+ return;
+ }
+ }
+ var img = new Image();
+ img.onload = function() {
+ icon.size = new google.maps.Size(img.width, img.height);
+ icon.scaledSize = new google.maps.Size(img.width, img.height);
+ icon.anchor = new google.maps.Point(img.width / 2, img.height / 2);
+ self.set('labelMarkerAnchor', new google.maps.Point(img.width / 2, img.height / 2));
+ iconMarker.setIcon(icon);
+ };
+ img.onerror = function(e) {
+ console.error(e);
+ };
+ img.src = iconUrl;
+ });
+
+ //debug
+ //var positionConfirmMarker = new google.maps.Marker();
+ //labelMarker.bindTo('position', positionConfirmMarker);
+ //labelMarker.bindTo('map', positionConfirmMarker);
for (var key in options) {
self.set(key, options[key]);
@@ -608,6 +641,7 @@ ClusterIconClass.prototype.draw = function() {
// debug
//ctx.fillStyle="#FF000077";
//ctx.fillRect(0, 0, canvas.width, canvas.height);
+
if (labelOptions.text) {
var fontStyles = [];

(Browser) Fix: Null pointer error in PluginMarker.js
(Browser) Fix: ClusterIcon anchor is incorrect.