Implementing ballon style for KmlOverlay
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.1.2-beta-20171127-1928" 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.1.2-beta-20171127-2321" 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/KmlOverlay.js
www/KmlOverlay.js
@@ -2,7 +2,9 @@ var argscheck = require('cordova/argscheck'),
utils = require('cordova/utils'),
common = require('./Common'),
BaseClass = require('./BaseClass'),
- BaseArrayClass = require('./BaseArrayClass');
+ event = require('./event'),
+ BaseArrayClass = require('./BaseArrayClass'),
+ HtmlInfoWindow = require('./HtmlInfoWindow');
/*****************************************************************************
* KmlOverlay Class
@@ -40,6 +42,26 @@ var KmlOverlay = function(map, kmlId, viewport, overlays) {
value: overlays,
writable: false
});
+ var ballon = new HtmlInfoWindow();
+ var onMarkerClick = function(position, marker) {
+ ballon.setContent(marker.get("description"));
+ ballon.open(marker);
+ };
+
+
+ var seekOverlays = function(children) {
+ children.forEach(function(child) {
+ if (child.type === "Marker") {
+ child.on(event.MARKER_CLICK, onMarkerClick);
+ }
+ if ('children' in child &&
+ utils.isArray(child.children)) {
+ seekOverlays(child.children);
+ }
+ });
+ };
+
+ seekOverlays(overlays);
/*
var ignores = ["map", "id", "hashCode", "type"];
for (var key in kmlOverlayOptions) {

MODIFY
www/Map.js
www/Map.js
@@ -937,8 +937,8 @@ function markerPlacemark(self, params, callback) {
delete params.child.coordinates;
params.viewport.extend(params.child.position);
- params.child.title = params.placeMark.name;
- params.child.snippet = params.placeMark.description;
+ //params.child.title = params.placeMark.name;
+ //params.child.snippet = params.placeMark.description;
getStyleById(self, params, function(styles) {
styles.children.forEach(function(style) {

MODIFY
www/googlemaps-cdv-plugin.js
www/googlemaps-cdv-plugin.js
@@ -670,7 +670,7 @@ if (!cordova) {
});
document.addEventListener("plugin_touch", resetTimer);
window.addEventListener("orientationchange", function() {
- var cnt = 10;
+ var cnt = 30;
resetTimer({force: true});
var timer = setInterval(function() {
cnt--;

Implementing ballon style for KmlOverlay