Skip to content

feat!: improve google maps integration#191

Merged
harlan-zw merged 8 commits into
mainfrom
feat/google-map-improvements
Aug 7, 2024
Merged

feat!: improve google maps integration#191
harlan-zw merged 8 commits into
mainfrom
feat/google-map-improvements

Conversation

@harlan-zw
Copy link
Copy Markdown
Collaborator

@harlan-zw harlan-zw commented Aug 6, 2024

🔗 Linked issue

#103
#187
#169
#83

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

The current implementation of Google Maps has some issues, this is due to how unclear API boundaries. We need a tighter coupling around shared map and a placeholder props, everything else needs to be exposed to end users so they can implement it themselves.

Docs will still need some work in the future.

🚀 Features

  • markers prop (string | AdvancedMapMarkerOptions)[]

Customize the markers displayed on the static map and the interactive map. Fully reactive.

<script lang="ts" setup>
const markers = [
	'-34.397,150.644', // provide a string as lng,lat 
   { position: { lng: -34.397, lat: 150.644 } } // OR provide an bject
]
</script>
<template>
  <ScriptGoogleMaps :markers="['-34.397,150.644', { position: { lng: -34.397, lat: 150.644 } }]" />
</template>
  • centerMarker prop boolean

Controls whether a marker is placed at the center position.

⚠️ Breaking Changes

  • options is renamed to mapOptions
  <ScriptGoogleMap
-    :options=""
+    :map-options=""
   />
  • query is renamed to center, it's now recommended to use {longitude},{latitude} rather than a text query.
  <ScriptGoogleMap
-    :query=""
+    :center=""
   />
  • The exposed internal API signature is now different.
<script lang="ts" setup>
const maps = ref()
onMounted(() => {
-  maps.value // google maps instance
+  maps.value // { googleMaps, map, createAdvancedMapMarker, resolveQueryToLatLang, importLibrary }
})
</script>
<template>
   <ScriptGoogleMap ref="maps" />
</template>

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Aug 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
scripts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 6:40am
scripts-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 6:40am

@harlan-zw harlan-zw marked this pull request as ready for review August 7, 2024 05:16
@harlan-zw harlan-zw changed the title feat: improve google maps integration feat!: improve google maps integration Aug 7, 2024
Comment thread docs/components/content/GoogleMapsDemo.vue
- $5 per 1000 loads for the Geocoding API
- $2 per 1000 loads for the Static Maps API
- $2 per 1000 loads for the Static Maps API - You can avoid providing a `placeholder` slot.
- $5 per 1000 loads for the Geocoding API - You can avoid this by providing a `google.maps.LatLng` object instead of a string for the `center` prop
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we link to the source, where the amounts are coming from?
This might get outdated as time goes by, maybe we could add a disclaimer along the lines: "The example cost is based on this source. Actual cost may change. For more accurate cost estimation, please visit ... "

Comment thread playground/pages/third-parties/google-maps/center.vue
@harlan-zw harlan-zw mentioned this pull request Aug 22, 2024
zizzfizzix pushed a commit to zizzfizzix/nuxt-scripts that referenced this pull request Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants