From 0ea377c29ab8d56c8bf2cc125c0df1a9cb656560 Mon Sep 17 00:00:00 2001 From: Oliver Kirsch Date: Wed, 15 Feb 2023 08:36:36 +0100 Subject: [PATCH] Attempt to fix closeclick issue in InfoWindow - propagate google maps InfoWindow's closeclick event to the parent component however, re-open the InfoWindow to ensure, its state is set solely by the opened prop of the InfoWindow component - do not emit closeclick in the _openInfoWindow() method triggered by the watcher on the opened prop. closeclick should only be triggered, when the user atually clicked close --- src/components/infoWindow.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/infoWindow.vue b/src/components/infoWindow.vue index 352ca8e..df9ff34 100644 --- a/src/components/infoWindow.vue +++ b/src/components/infoWindow.vue @@ -67,14 +67,16 @@ export default buildComponent({ this.$infoWindowObject.close() if (this.opened) { this.$infoWindowObject.open(this.$map, this.$markerObject) - } else { - this.$emit('closeclick') } }, }, afterCreate() { this._openInfoWindow() + this.$infoWindowObject.addListener('closeclick', () => { + this.$emit('closeclick') + this.$infoWindowObject.open(this.$map, this.$markerObject) + }) this.$watch('opened', () => { this._openInfoWindow() })