From daabc2db0c7f5eacd643d81fec421080d39d56d3 Mon Sep 17 00:00:00 2001 From: 8bhsolutions <48874658+8bhsolutions@users.noreply.github.com> Date: Wed, 20 May 2020 10:00:53 +1000 Subject: [PATCH 1/2] Ability to change clickability of POI --- src/android/plugin/google/maps/PluginMap.java | 15 +++++++++++++++ www/Map.js | 11 +++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/android/plugin/google/maps/PluginMap.java b/src/android/plugin/google/maps/PluginMap.java index a3d379f0e..46dd6e78a 100644 --- a/src/android/plugin/google/maps/PluginMap.java +++ b/src/android/plugin/google/maps/PluginMap.java @@ -3179,5 +3179,20 @@ public void onRequestPermissionResult(int requestCode, String[] permissions, } } + public void setClickablePOI(JSONArray args, final CallbackContext callbackContext) throws JSONException { + final boolean clickable = args.getBoolean(0); + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + if (clickable) { + map.setOnPoiClickListener(PluginMap.this); + } else { + map.setOnPoiClickListener(null); + } + callbackContext.success(); + } + }); + } + } diff --git a/www/Map.js b/www/Map.js index 80373fc0c..c4bb630a8 100644 --- a/www/Map.js +++ b/www/Map.js @@ -1586,4 +1586,15 @@ Map.prototype._onCameraEvent = function(eventName, cameraPosition) { } }; +Map.prototype.setClickablePOI = function(isClickable) { + var self = this; + isClickable = common.parseBoolean(isClickable); + self.set('clickablePOI', isClickable); + self.exec.call(self, null, self.errorHandler, this.__pgmId, 'setClickablePOI', [isClickable]); + return this; +}; +Map.prototype.getClickablePOI = function() { + return this.get('clickablePOI'); +}; + module.exports = Map; From af6303a485fd257e6d38b9ada6473a466ec41a8e Mon Sep 17 00:00:00 2001 From: 8bhsolutions <48874658+8bhsolutions@users.noreply.github.com> Date: Wed, 20 May 2020 12:10:41 +1000 Subject: [PATCH 2/2] Fix getClickablePOI returning incorrect value, if developer doesn't execute setClickablePOI --- www/Map.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/www/Map.js b/www/Map.js index c4bb630a8..c97bb53bc 100644 --- a/www/Map.js +++ b/www/Map.js @@ -89,6 +89,8 @@ Map.prototype.getMap = function(meta, div, options) { args = [meta]; options = options || {}; + self.set('clickablePOI', true) // Current POI are clickable by default + self.set('clickable', options.clickable === false ? false : true); self.set('visible', options.visible === false ? false : true);