File tree Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change 87
87
}
88
88
89
89
function clearAllMarkers () {
90
- markers .forEach (({ marker, overlay, element }) => {
91
- mapInstance .removeMarker (marker);
92
-
93
- if (overlay) {
94
- overlay .setMap (null );
95
- overlay .draw = () => {};
96
- overlay .onRemove ? .();
97
- }
98
- element? .parentNode ? .removeChild (element);
90
+ markers .forEach ((markerObj ) => {
91
+ mapInstance .removeMarker (markerObj);
99
92
});
100
93
markers = [];
101
94
}
Original file line number Diff line number Diff line change @@ -66,15 +66,20 @@ export default class GoogleMapProvider {
66
66
} ) ;
67
67
68
68
const overlay = new google . maps . OverlayView ( ) ;
69
- overlay . setMap ( this . map ) ;
70
- overlay . draw = function ( ) {
69
+ overlay . onAdd = function ( ) {
70
+ this . getPanes ( ) . overlayMouseTarget . appendChild ( container ) ;
71
+ } ;
72
+ overlay . draw = function ( ) {
71
73
const projection = this . getProjection ( ) ;
72
74
const position = projection . fromLatLngToDivPixel ( marker . getPosition ( ) ) ;
73
75
container . style . left = position . x - 20 + 'px' ;
74
76
container . style . top = position . y - 20 + 'px' ;
75
77
container . style . position = 'absolute' ;
76
- this . getPanes ( ) . overlayMouseTarget . appendChild ( container ) ;
77
78
} ;
79
+ overlay . onRemove = function ( ) {
80
+ container . parentNode . removeChild ( container ) ;
81
+ } ;
82
+ overlay . setMap ( this . map ) ;
78
83
79
84
return { marker, overlay, element : container } ;
80
85
} catch ( error ) {
You can’t perform that action at this time.
0 commit comments