add: KML_CLICK event
add: some options for map.addKmlOverlay()
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.2.0-beta-20180118-1628" 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.2.0-beta-20180118-1847" 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/KmlLoader.js
www/KmlLoader.js
@@ -920,7 +920,9 @@ KmlLoader.prototype.parseNetworkLinkTag = function(params, callback) {
overlay.setVisible(true);
} else {
self.map.addKmlOverlay({
- url: networkLinkOptions.link.href
+ url: networkLinkOptions.link.href,
+ clickable: self.options.clickable,
+ suppressInfoWindows: self.options.suppressInfoWindows
}, function(overlay) {
networkOverlay.set("overlay", overlay);
});

MODIFY
www/KmlOverlay.js
www/KmlOverlay.js
-var argscheck = require('cordova/argscheck'),
+ar argscheck = require('cordova/argscheck'),
utils = require('cordova/utils'),
common = require('./Common'),
BaseClass = require('./BaseClass'),
@@ -10,7 +10,7 @@ var argscheck = require('cordova/argscheck'),
* KmlOverlay Class
*****************************************************************************/
var exec;
-var KmlOverlay = function(map, kmlId, camera, kmlData) {
+var KmlOverlay = function(map, kmlId, camera, kmlData, kmlOverlayOptions) {
BaseClass.apply(this);
var self = this;
@@ -80,6 +80,11 @@ var KmlOverlay = function(map, kmlId, camera, kmlData) {
var ballon = new HtmlInfoWindow();
var onOverlayClick = function(position, overlay) {
+ self.trigger(event.KML_CLICK, overlay, position);
+
+ if (kmlOverlayOptions.suppressInfoWindows) {
+ return;
+ }
map.get("invisible_dot").setPosition(position);
var description = overlay.get("description");
@@ -208,7 +213,10 @@ var KmlOverlay = function(map, kmlId, camera, kmlData) {
}
};
+ if (kmlOverlayOptions.clickable) {
kmlData.forEach(seekOverlays);
+ }
+
/*
var ignores = ["map", "id", "hashCode", "type"];
for (var key in kmlOverlayOptions) {

MODIFY
www/Map.js
www/Map.js
@@ -813,6 +813,8 @@ Map.prototype.addKmlOverlay = function(kmlOverlayOptions, callback) {
var self = this;
kmlOverlayOptions = kmlOverlayOptions || {};
kmlOverlayOptions.url = kmlOverlayOptions.url || null;
+ kmlOverlayOptions.clickable = common.defaultTrueOption(kmlOverlayOptions.clickable);
+ kmlOverlayOptions.suppressInfoWindows = kmlOverlayOptions.suppressInfoWindows === true;
var loader = new KmlLoader(self, exec, kmlOverlayOptions);
loader.parseKmlFile(function(camera, kmlData) {
@@ -820,7 +822,7 @@ Map.prototype.addKmlOverlay = function(kmlOverlayOptions, callback) {
kmlData = new BaseArrayClass([kmlData]);
}
var kmlId = "kmloverlay_" + Math.floor(Math.random() * Date.now());
- var kmlOverlay = new KmlOverlay(self, kmlId, camera, kmlData);
+ var kmlOverlay = new KmlOverlay(self, kmlId, camera, kmlData, kmlOverlayOptions);
self.OVERLAYS[kmlId] = kmlOverlay;
callback(kmlOverlay);
});

MODIFY
www/event.js
www/event.js
@@ -3,8 +3,8 @@ module.exports = {
MAP_CLICK: 'map_click',
MAP_LONG_CLICK: 'map_long_click',
POI_CLICK: 'poi_click',
- MY_LOCATION_BUTTON_CLICK: 'my_location_button_click',
MY_LOCATION_CLICK: 'my_location_click',
+ MY_LOCATION_BUTTON_CLICK: 'my_location_button_click',
INDOOR_BUILDING_FOCUSED: 'indoor_building_focused',
INDOOR_LEVEL_ACTIVATED: 'indoor_level_activated',
CAMERA_MOVE_START: 'camera_move_start',
@@ -26,5 +26,6 @@ module.exports = {
MARKER_DRAG_END: 'marker_drag_end',
MAP_DRAG: 'map_drag',
MAP_DRAG_START: 'map_drag_start',
- MAP_DRAG_END: 'map_drag_end'
+ MAP_DRAG_END: 'map_drag_end',
+ KML_CLICK: 'kml_click'
};

-add: KML_CLICK event
-add: some options for map.addKmlOverlay()