From 3fe6377274c924ab4c7baa509f39ae3b1066f7ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Zbi=C5=84ski?= Date: Mon, 3 Jun 2019 12:24:43 +0200 Subject: [PATCH] Fixed moving of markers --- gmap-custom-marker.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gmap-custom-marker.vue b/gmap-custom-marker.vue index 63d0ed9..881d5d2 100644 --- a/gmap-custom-marker.vue +++ b/gmap-custom-marker.vue @@ -79,7 +79,7 @@ export default { const div = self.$el; const projection = this.getProjection(); if (projection && div) { - const posPixel = projection.fromLatLngToDivPixel(self.position); + const posPixel = projection.fromLatLngToDivPixel(self.latLng); let x, y; switch (self.alignment) { case "top": @@ -181,6 +181,12 @@ export default { return self.lng; } }; + }, + latLng() { + if (this.marker instanceof google.maps.LatLng) { + return this.marker; + } + return new google.maps.LatLng(this.lat, this.lng); } }, destroyed() {