From 7faf764df91154b9f956d0910d81d167c918cc8a Mon Sep 17 00:00:00 2001 From: Jerome2606 Date: Thu, 30 Jul 2015 09:39:30 +0200 Subject: [PATCH] Pass custom variables to a marker #54 https://github.com/wf9a5m75/phonegap-googlemaps-plugin/issues/54 Add a params object to marker to add specific parameters (like Id, url, etc.) that can be use in infoClick or other events from marker.getParams() --- www/googlemaps-cdv-plugin.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/www/googlemaps-cdv-plugin.js b/www/googlemaps-cdv-plugin.js index a6ca525d4..9e92c7cbf 100644 --- a/www/googlemaps-cdv-plugin.js +++ b/www/googlemaps-cdv-plugin.js @@ -886,6 +886,7 @@ App.prototype.addMarker = function(markerOptions, callback) { markerOptions.rotation = markerOptions.rotation || 0; markerOptions.opacity = parseFloat("" + markerOptions.opacity, 10) || 1; markerOptions.disableAutoPan = markerOptions.disableAutoPan === undefined ? false: markerOptions.disableAutoPan; + markerOptions.params = markerOptions.params || {}; if ("styles" in markerOptions) { markerOptions.styles = typeof markerOptions.styles === "object" ? markerOptions.styles : {}; @@ -1244,6 +1245,9 @@ Marker.prototype.setDisableAutoPan = function(disableAutoPan) { this.set('disableAutoPan', disableAutoPan); cordova.exec(null, this.errorHandler, PLUGIN_NAME, 'exec', ['Marker.setDisableAutoPan', this.getId(), disableAutoPan]); }; +Marker.prototype.getParams = function () { + return this.get('params'); +}; Marker.prototype.setOpacity = function(opacity) { this.set('opacity', opacity); cordova.exec(null, this.errorHandler, PLUGIN_NAME, 'exec', ['Marker.setOpacity', this.getId(), opacity]);