vue-google-maps icon indicating copy to clipboard operation
vue-google-maps copied to clipboard

Marker icon not refreshes on change

Open altercode opened this issue 6 years ago • 5 comments

Hi,

I have map with markers. When I dynamically change marker icon this change is not reflected on the map. How can I refresh/rerender the map to apply new icon image?

Thats how I change marker object:

Event.$on('update-marker-data', (data) => {
this.markers[data.index] = data.marker
      });

And thats what my data.marker object structure looks like:

{
              title: 'New point',
              description: '',
              marker: {
                url: '/marker2.png',
                scaledSize: new google.maps.Size(50, 50), // scaled size
                origin: new google.maps.Point(0,0), // origin
                anchor: new google.maps.Point(25,40) // anchor
              },
              position: {
                lat: lat,
                lng: lng,
              },
            }

When I inspect in Vue Dev Tools new url is applied but on the map there is still old icon image visible.

Thanks in advance for any help!

altercode avatar Apr 01 '19 06:04 altercode

@xkjyeah can you help me with this?

altercode avatar Apr 02 '19 23:04 altercode

did you ever solve this?

exzib avatar Jun 24 '19 14:06 exzib

you try make data is reactive to re-render map

cuongdevjs avatar Jul 01 '19 03:07 cuongdevjs

Hey all,

You may use my component to use custom components, that makes it simple to have reactive and dynamic markers : https://github.com/eregnier/vue2-gmap-custom-marker

eregnier avatar Jan 10 '20 13:01 eregnier

I have similar problem. I call setIcon, but the map does not refreshes immediatelly. When I zoom in/out or pan a distance enough to hide the update marker an show him again, so the correct icon is displayed. But for me it occurs only when lot of markers are shown, +10K. In a test with 3K markers, the problem does not occur.

patrickdalla avatar Dec 12 '22 11:12 patrickdalla