ivory-google-map icon indicating copy to clipboard operation
ivory-google-map copied to clipboard

MarkerClusterer: a.getPosition is not a function

Open Defcon0 opened this issue 6 years ago • 0 comments

Hello,

when including the MarkerClusterer, I get:

markerclusterer.min.js:1 Uncaught TypeError: a.getPosition is not a function
    at MarkerClusterer.isMarkerInBounds_ (markerclusterer.min.js:1)
    at MarkerClusterer.createClusters_ (markerclusterer.min.js:1)
    at MarkerClusterer.setReady_ (markerclusterer.min.js:1)
    at MarkerClusterer.onAdd (markerclusterer.min.js:1)
    at MarkerClusterer.Wz (overlay.js:1)
    at Yz._.Rf.B (js?v=3&language=en&key=AIzaSyC2_LcHBd66GwtvEdmOv63XW4o52Mx0mvU&callback=google.loader.callbacks.maps:139)
    at Qg.trigger (js?v=3&language=en&key=AIzaSyC2_LcHBd66GwtvEdmOv63XW4o52Mx0mvU&callback=google.loader.callbacks.maps:123)
    at Qg.<anonymous> (js?v=3&language=en&key=AIzaSyC2_LcHBd66GwtvEdmOv63XW4o52Mx0mvU&callback=google.loader.callbacks.maps:52)
    at _.dw.trigger (js?v=3&language=en&key=AIzaSyC2_LcHBd66GwtvEdmOv63XW4o52Mx0mvU&callback=google.loader.callbacks.maps:123)
    at _.dw.<anonymous> (js?v=3&language=en&key=AIzaSyC2_LcHBd66GwtvEdmOv63XW4o52Mx0mvU&callback=google.loader.callbacks.maps:52)

This is because, for unknown reasons, some functions are also passed to the MarkerClusterer constructor in the generated JavaScript:

map5af554434ba9c709193302_container.functions.to_array(map5af554434ba9c709193302_container.overlays.markers)

returns

0:_.Ie {__gm: {…}, gm_accessors_: {…}, position: _.D, gm_bindings_: {…}, zIndex: 666, …}
1:_.Ie {__gm: {…}, gm_accessors_: {…}, position: _.D, gm_bindings_: {…}, zIndex: 666, …}
2:ƒ (obj)
3:ƒ (name, item)
4:ƒ (name, item, fromIndex)

But only the first two markers are my markers (I only added 2 of them to my map). The latter 3 functions are passed in erroneously I think.

Maybe a bug?

Defcon0 avatar May 11 '18 08:05 Defcon0