Creating fusion table layer
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.5.0-beta-20181020-0912" 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.5.0-beta-20181023-0940" 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" />
<asset src="www/promise-7.0.4.min.js.map" target="promise-7.0.4.min.js.map" />

MODIFY
src/browser/PluginFusionTableOverlay.js
src/browser/PluginFusionTableOverlay.js
var utils = require('cordova/utils'),
- BaseClass = require('cordova-plugin-googlemaps.BaseClass');
+ event = require('cordova-plugin-googlemaps.event'),
+ BaseClass = require('cordova-plugin-googlemaps.BaseClass'),
+ LatLng = require('cordova-plugin-googlemaps.LatLng');
function PluginFusionTableOverlay(pluginMap) {
var self = this;
@@ -18,9 +20,9 @@ utils.extend(PluginFusionTableOverlay, BaseClass);
PluginFusionTableOverlay.prototype._create = function(onSuccess, onError, args) {
var self = this,
map = self.pluginMap.get('map'),
- hashCode = args[2],
- fusionTableOverlayId = 'FusionTableOverlay_' + hashCode,
- pluginOptions = args[1];
+ fusionTableOverlayId = args[2],
+ pluginOptions = args[1],
+ mapId = self.pluginMap.__pgmId;
var fusionTableOpts = {
'map': map,
@@ -43,6 +45,24 @@ PluginFusionTableOverlay.prototype._create = function(onSuccess, onError, args)
var fusionTableOverlay = new google.maps.FusionTablesLayer(fusionTableOpts);
+ fusionTableOverlay.addListener('click', function(mouseEvent) {
+
+ if (mapId in plugin.google.maps) {
+ plugin.google.maps[mapId]({
+ 'evtName': event.FUSION_TABLE_CLICK,
+ 'callback': '_onOverlayEvent',
+ 'args': [fusionTableOverlayId, {
+ 'infoWindowHtml': mouseEvent.infoWindowHtml,
+ 'latLng': new LatLng(mouseEvent.latLng.lat(), mouseEvent.latLng.lng()),
+ 'row': {
+ 'columnName': mouseEvent.row.columnName,
+ 'value': mouseEvent.row.value
+ }
+ }]
+ });
+ }
+ });
+
self.pluginMap.objects[fusionTableOverlayId] = fusionTableOverlay;
onSuccess({

MODIFY
www/Map.js
www/Map.js
-
var utils = require('cordova/utils'),
cordova_exec = require('cordova/exec'),
common = require('./Common'),
@@ -1050,6 +1049,8 @@ Map.prototype.addFusionTableOverlay = function(fusionTableOptions, callback) {
var fusionTableOverlay = new FusionTableOverlay(self, fusionTableOptions, exec);
+ var fusionTableOverlayId = fusionTableOverlay.getId();
+ self.OVERLAYS[fusionTableOverlayId] = fusionTableOverlay;
if (cordova.platformId === 'browser') {
//----------------------------------
// Browser: use FusionTable layer
@@ -1062,7 +1063,7 @@ Map.prototype.addFusionTableOverlay = function(fusionTableOptions, callback) {
if (typeof callback === 'function') {
callback.call(self, fusionTableOverlay);
}
- }, self.errorHandler, self.__pgmId, 'loadPlugin', ['FusionTableOverlay', fusionTableOptions, fusionTableOverlay.hashCode]);
+ }, self.errorHandler, self.__pgmId, 'loadPlugin', ['FusionTableOverlay', fusionTableOptions, fusionTableOverlayId]);
if (typeof callback === 'function') {
callback(fusionTableOverlay);

MODIFY
www/js_CordovaGoogleMaps-for-browser.js
www/js_CordovaGoogleMaps-for-browser.js
+
if (!window.Promise) {
window.Promise = require('cordova-plugin-googlemaps.Promise');
}
@@ -11,6 +12,7 @@ var common = require('cordova-plugin-googlemaps.Common'),
function nativeCallback(params) {
var args = params.args || [];
args.unshift(params.evtName);
+
this[params.callback].apply(this, args);
}

Creating fusion table layer