Skip to content

Commit

Permalink
fix: custom markers reactivity
Browse files Browse the repository at this point in the history
  • Loading branch information
HusamElbashir authored Aug 27, 2023
1 parent ba1021b commit 4a06b12
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function createCustomMarkerClass(api: typeof google.maps): ICustomMarkerC
if (!this.element) return;

const overlayProjection = this.getProjection();
const point = overlayProjection.fromLatLngToDivPixel(this.getPosition());
const point = overlayProjection?.fromLatLngToDivPixel(this.getPosition());

if (point) {
this.element.style.position = "absolute";
Expand Down Expand Up @@ -122,8 +122,11 @@ export function createCustomMarkerClass(api: typeof google.maps): ICustomMarkerC
this.element.remove();
}

setOptions(opts: google.maps.CustomMarkerOptions) {
this.opts = opts;
setOptions(opts: google.maps.CustomMarkerOptions & { element?: HTMLElement }) {
const { element, ...rest } = opts;

this.element = element;
this.opts = rest;
this.draw();
}
};
Expand Down

0 comments on commit 4a06b12

Please sign in to comment.