fix: putHtmlElements() does not return sometimes
fix: HtmlInfoWindow always 80% of the map div width
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.3.0-beta-20180408-1032" 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.3.0-beta-20180408-2222" 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
src/android/plugin/google/maps/CordovaGoogleMaps.java
src/android/plugin/google/maps/CordovaGoogleMaps.java
@@ -471,6 +471,7 @@ public class CordovaGoogleMaps extends CordovaPlugin implements ViewTreeObserver
//------------------------------------------
JSONObject meta = args.getJSONObject(0);
String mapId = meta.getString("id");
+ Log.d(TAG, "---> mapId = " + mapId);
PluginStreetViewPanorama pluginStreetView = new PluginStreetViewPanorama();
pluginStreetView.privateInitialize(mapId, cordova, webView, null);
pluginStreetView.initialize(cordova, webView);

MODIFY
src/android/plugin/google/maps/MyPluginLayout.java
src/android/plugin/google/maps/MyPluginLayout.java
@@ -56,7 +56,7 @@ public class MyPluginLayout extends FrameLayout implements ViewTreeObserver.OnSc
public boolean isWaiting = false;
private static final Object timerLock = new Object();
- public Timer redrawTimer;
+ private static Timer redrawTimer;
@Override
public void onGlobalLayout() {
@@ -238,7 +238,7 @@ public class MyPluginLayout extends FrameLayout implements ViewTreeObserver.OnSc
redrawTimer = new Timer();
redrawTimer.scheduleAtFixedRate(new ResizeTask(), 0, 25);
- mActivity.getWindow().getDecorView().requestFocus();
+ //mActivity.getWindow().getDecorView().requestFocus(); <--- This changes thread number sometimes. Do not use this!
isSuspended = false;
}
}
@@ -417,7 +417,7 @@ public class MyPluginLayout extends FrameLayout implements ViewTreeObserver.OnSc
//Log.d("MyPluginLayout", "--> removePluginMap / mapId = " + mapId);
- mActivity.getWindow().getDecorView().requestFocus();
+ //mActivity.getWindow().getDecorView().requestFocus();
} catch (Exception e) {
// ignore
//e.printStackTrace();
@@ -454,7 +454,7 @@ public class MyPluginLayout extends FrameLayout implements ViewTreeObserver.OnSc
int depth = pluginOverlay.getViewDepth();
int childCnt = scrollFrameLayout.getChildCount();
View view;
- int index = 0;
+ int index = childCnt - 1;
for (int i = childCnt - 1; i >= 0; i--) {
view = scrollFrameLayout.getChildAt(i);
if (view.getTag() == null) {
@@ -466,10 +466,11 @@ public class MyPluginLayout extends FrameLayout implements ViewTreeObserver.OnSc
}
}
+ Log.d(TAG, "---->index = " + index);
scrollFrameLayout.addView(pluginOverlay.getView(), index + 1);
}
- mActivity.getWindow().getDecorView().requestFocus();
+ //mActivity.getWindow().getDecorView().requestFocus();
//updateViewPosition(pluginMap.mapId);
@@ -696,7 +697,7 @@ public class MyPluginLayout extends FrameLayout implements ViewTreeObserver.OnSc
}
isScrolling = (action == MotionEvent.ACTION_DOWN) || isScrolling;
- browserView.requestFocus(View.FOCUS_DOWN);
+ //browserView.requestFocus(View.FOCUS_DOWN);
return false;
}

MODIFY
www/HtmlInfoWindow.js
www/HtmlInfoWindow.js
@@ -47,13 +47,11 @@ var HTMLInfoWindow = function() {
}
};
-
Object.defineProperty(self, "_hook", {
value: listenerMgr,
writable: false
});
-
var frame = document.createElement("div");
frame.style.overflow = "visible";
frame.style.position = "absolute";
@@ -81,7 +79,6 @@ var HTMLInfoWindow = function() {
anchorDiv.appendChild(frame);
self.set("anchor", anchorDiv);
-
var contentBox = document.createElement("div");
contentBox.style.display = "inline-block";
contentBox.style.padding = "5px";
@@ -145,7 +142,6 @@ var HTMLInfoWindow = function() {
tailLeft.appendChild(tailLeftCover);
*/
-
var tailRight = document.createElement("div");
/*
tailRight.style.position = "absolute";
@@ -206,8 +202,7 @@ var HTMLInfoWindow = function() {
var contentFrame = frame.firstChild;
var contentBox = contentFrame.firstChild;
contentBox.style.minHeight = "50px";
- contentBox.style.width = (div.offsetWidth * 0.7) + "px";
-
+ contentBox.style.width = "auto";
var content = self.get("content");
if (typeof content === "string") {
@@ -245,7 +240,10 @@ var HTMLInfoWindow = function() {
contentFrame.style.height = contentsHeight + "px";
frame.style.width = contentsWidth + "px";
frame.style.height = (contentsHeight + 15) + "px";
- //console.log("contentWidth = " + contentBox.offsetWidth + ", contentsHeight = " + contentsHeight);
+
+ if (contentBox.offsetWidth > div.offsetWidth * 0.9) {
+ contentBox.style.width = (div.offsetWidth * 0.9) + "px";
+ }
var infoOffset = {
x: 31,
@@ -307,8 +305,6 @@ var HTMLInfoWindow = function() {
anchor.y *= iconSize.height;
anchor.x *= iconSize.width;
-
-
//console.log("contentsSize = " + contentsWidth + ", " + contentsHeight);
//console.log("iconSize = " + iconSize.width + ", " + iconSize.height);
//console.log("infoOffset = " + infoOffset.x + ", " + infoOffset.y);
@@ -324,11 +320,9 @@ var HTMLInfoWindow = function() {
self.set("offsetX", offsetX);
self.set("offsetY", offsetY);
-
frame.style.bottom = (iconSize.height - infoOffset.y) + "px";
frame.style.left = ((-contentsWidth) / 2 + infoOffset.x) + "px";
-
//console.log("frameLeft = " + frame.style.left );
var point = map.get("infoPosition");
anchorDiv.style.visibility = "hidden";
@@ -433,7 +427,10 @@ HTMLInfoWindow.prototype.open = function(marker) {
});
map.fromLatLngToPoint(marker.getPosition(), function (point) {
- map.set("infoPosition", {x: point[0], y: point[1]});
+ map.set("infoPosition", {
+ x: point[0],
+ y: point[1]
+ });
self._hook.bindTo(map, "infoPosition", self);
self._hook.bindTo(marker, "infoWindowAnchor", self);

MODIFY
www/StreetViewPanorama.js
www/StreetViewPanorama.js
@@ -60,9 +60,9 @@ StreetViewPanorama.prototype.getHashCode = function() {
StreetViewPanorama.prototype.getId = function() {
return this.id;
};
-StreetViewPanorama.prototype.getPanorama = function(panoramaId, div, options) {
+StreetViewPanorama.prototype.getPanorama = function(meta, div, options) {
var self = this,
- args = [panoramaId];
+ args = [meta];
options = options || {};

- fix: putHtmlElements() does not return sometimes
- fix: HtmlInfoWindow always 80% of the map div width