xkjyeah / vue-google-maps

Google maps component for vue with 2-way data binding
https://xkjyeah.github.io/vue-google-maps/
1.88k stars 474 forks source link

Component is re rendering again and again. #739

Open rehan-sattar opened 4 years ago

rehan-sattar commented 4 years ago

When I'm opening the info window on cluster on mouse over event, the component is re rendering again and again.

image

Here is my function where I'm opening the window.

openWindow(position: IInfoWindowPosition, options: IInfoWindowOptions): void {
    this.infoWindowOptions.content = options.content
    this.infoWindowPosition = position
    this.openInfoWindow = true
    this.infoWindowOptions.pixelOffset = options.pixelOffset
  }

Here is the flow where I'm triggering the events and catching them:

<gmap-cluster
          @mouseover="showCountryAndCityNamesInWindow"
          @mouseout="closeInfoWindow"
          :zoomOnClick="true"
          :styles="clusterStyles"
        >
          <gmap-info-window
            :options="infoWindowOptions"
            :position="infoWindowPosition"
            :opened="openInfoWindow"
          />
</gmap-cluster>

showCountryAndCityNamesInWindow(event) {
    // extra code here ....
    this.openWindow(position, options)
  }

NOTE: There is no mouseenter event in your component. Therefore I had to use mousehover for this feature.