diff --git a/components/Map.vue b/components/Map.vue
index 26267f9..da82e63 100644
--- a/components/Map.vue
+++ b/components/Map.vue
@@ -6,8 +6,8 @@
+
+
diff --git a/components/Marker.vue b/components/Marker.vue
index 868cb5a..8c2ac0c 100644
--- a/components/Marker.vue
+++ b/components/Marker.vue
@@ -1,30 +1,20 @@
-
-
+ marker
diff --git a/docs/src/components/map.md b/docs/src/components/map.md
old mode 100755
new mode 100644
index 1a6cd18..1960d62
--- a/docs/src/components/map.md
+++ b/docs/src/components/map.md
@@ -38,4 +38,40 @@ You can also disable specific UI components
fullscreenControl: true,
}"
/>
+```
+
+
+## Access google maps instance
+You can easily access Map instance by injecting it in your component.
+
+```javascript
+ const loadMap = inject(
+ "mapPromise"
+ );
+
+ loadMap.then(map=> {
+ console.log( {map})
+ })
+```
+
+
+## Add custom button
+You can use the map instance to add custom buttons to your map
+```js
+export function addMyButton(map) {
+ const controlDiv = document.createElement("div");
+ const controlUI = document.createElement("button");
+ controlUI.title = "Click to zoom the map";
+ controlDiv.appendChild(controlUI);
+ const controlText = document.createElement("div");
+ controlText.innerHTML = `Center`;
+ controlUI.appendChild(controlText);
+ controlUI.style.position = "relative"
+ controlUI.style.bottom = "80px"
+ controlUI.addEventListener("click", () => {
+ map.setZoom(map.getZoom() + 1);
+ });
+
+ map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(controlDiv); // eslint-disable-line no-undef
+}
```
\ No newline at end of file
diff --git a/docs/src/components/marker.md b/docs/src/components/marker.md
old mode 100755
new mode 100644
index e597a99..ba58042
--- a/docs/src/components/marker.md
+++ b/docs/src/components/marker.md
@@ -19,7 +19,8 @@ With marker you can show specific locations on the map
## Center markers automatically
To center markers so that all the markers are visible, use:
```vue
-
+
-```
+```
\ No newline at end of file
diff --git a/docs/src/docs/getting-started.md b/docs/src/docs/getting-started.md
old mode 100755
new mode 100644
index 780e29a..4e0ef3a
--- a/docs/src/docs/getting-started.md
+++ b/docs/src/docs/getting-started.md
@@ -29,3 +29,10 @@ app.use(googleMap, googleMapOption)
app.mount('#app')
```
+
+## Options
+apiKey is required option to load maps, you may provide following additional options if you want.
+
+###`mapIds`
+Allows you to style the map using google cloud map styling
+
diff --git a/index.js b/index.js
index e3ccd08..dea00b3 100644
--- a/index.js
+++ b/index.js
@@ -12,5 +12,6 @@ export default {
app.component('Polygon', Polygon)
app.component('Rectangle', Rectangle)
app.provide('apiKey', options.apiKey)
+ app.provide('mapIds', options.mapIds)
}
}
\ No newline at end of file
diff --git a/utils/center-markers.js b/utils/center-markers.js
index caaf74a..9120c2a 100644
--- a/utils/center-markers.js
+++ b/utils/center-markers.js
@@ -6,7 +6,8 @@ export function fitMapToMarkers(geoCoordinates, mapInstance) {
mapInstance.setZoom(16);
} else if (geoCoordinates.length > 0) {
geoCoordinates.forEach(geoCoordinate => {
- bounds.extend({lat: geoCoordinate.position.lat, lng: geoCoordinate.position.lng});
+ if (geoCoordinate.lat && geoCoordinate.lng)
+ bounds.extend({lat: geoCoordinate.lat, lng: geoCoordinate.lng});
});
mapInstance.fitBounds(bounds);
}