Fix: plugin does not recognize HTML elements correctly after moving HTML elements with animations
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.3.4-beta-20180517-1004" 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.4-beta-20180522-1712" 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/CordovaGoogleMaps.js
www/CordovaGoogleMaps.js
@@ -425,6 +425,7 @@ CordovaGoogleMaps.prototype.invalidate = function(opts) {
if (opts.force) {
self.isThereAnyChange = true;
}
+ self.transforming = true;
common.nextTick(function() {
self.resume.call(self);

MODIFY
www/googlemaps-cdv-plugin.js
www/googlemaps-cdv-plugin.js
@@ -58,7 +58,9 @@ if (!cordova) {
var scrollEndTimer = null;
var transitionEndTimer = null;
var transformTargets = {};
+ var transitionCnt = 0;
function followMaps(evt) {
+ transitionCnt++;
cordovaGoogleMaps.transforming = true;
var changes = cordovaGoogleMaps.followMapDivPositionOnly.call(cordovaGoogleMaps);
if (scrollEndTimer) {
@@ -112,12 +114,13 @@ if (!cordova) {
if (transitionEndTimer) {
clearTimeout(transitionEndTimer);
}
- if (notYetTargets.length === 0) {
+ transitionCnt -= notYetTargets.length > 1 ? 1 : 0;
+ if (notYetTargets.length > 0 && transitionCnt == 0) {
+ transitionEndTimer = setTimeout(detectTransitionFinish, 100);
+ } else {
clearTimeout(transitionEndTimer);
transitionEndTimer = null;
setTimeout(onTransitionFinish, 100);
- } else {
- transitionEndTimer = setTimeout(detectTransitionFinish, 100);
}
}
@@ -152,6 +155,10 @@ if (!cordova) {
// If the `scroll` event is ocurred on the observed element,
// adjust the position and size of the map view
document.body.addEventListener("scroll", followMaps, true);
+ window.addEventListener("resize", function() {
+ cordovaGoogleMaps.transforming = true;
+ onTransitionFinish();
+ }, true);
});
}, {

Fix: plugin does not recognize HTML elements correctly after moving HTML elements with animations (#2280)