@@ -14,22 +14,56 @@ const routePath = [
1414 { lat: -33.8650, lng: 151.2090 },
1515 { lat: -33.8688, lng: 151.2093 },
1616]
17+
18+ const circleOptions = {
19+ center: { lat: -33.8688, lng: 151.2093 },
20+ radius: 800,
21+ fillColor: '#4285F4',
22+ fillOpacity: 0.12,
23+ strokeColor: '#4285F4',
24+ strokeWeight: 2,
25+ }
26+
27+ const polygonOptions = {
28+ paths: [
29+ { lat: -33.852, lng: 151.213 },
30+ { lat: -33.850, lng: 151.220 },
31+ { lat: -33.856, lng: 151.222 },
32+ { lat: -33.858, lng: 151.215 },
33+ ],
34+ fillColor: '#34a853',
35+ fillOpacity: 0.15,
36+ strokeColor: '#34a853',
37+ strokeWeight: 2,
38+ }
39+
40+ const polylineOptions = {
41+ path: routePath,
42+ strokeColor: '#ea4335',
43+ strokeOpacity: 1.0,
44+ strokeWeight: 3,
45+ }
46+
47+ const rectangleOptions = {
48+ bounds: {
49+ north: -33.870,
50+ south: -33.878,
51+ east: 151.218,
52+ west: 151.200,
53+ },
54+ fillColor: '#fbbc04',
55+ fillOpacity: 0.15,
56+ strokeColor: '#fbbc04',
57+ strokeWeight: 2,
58+ }
1759</script>
1860
1961<template>
2062 <ScriptGoogleMaps :center="{ lat: -33.863, lng: 151.210 }" :zoom="14">
21- <ScriptGoogleMapsCircle
22- :options="{ center: { lat: -33.8688, lng: 151.2093 }, radius: 800, fillColor: '#4285F4', fillOpacity: 0.12, strokeColor: '#4285F4', strokeWeight: 2 }"
23- />
24- <ScriptGoogleMapsPolygon
25- :options="{ paths: [{ lat: -33.852, lng: 151.213 }, { lat: -33.850, lng: 151.220 }, { lat: -33.856, lng: 151.222 }, { lat: -33.858, lng: 151.215 }], fillColor: '#34a853', fillOpacity: 0.15, strokeColor: '#34a853', strokeWeight: 2 }"
26- />
27- <ScriptGoogleMapsPolyline
28- :options="{ path: routePath, strokeColor: '#ea4335', strokeOpacity: 1.0, strokeWeight: 3 }"
29- />
30- <ScriptGoogleMapsRectangle
31- :options="{ bounds: { north: -33.870, south: -33.878, east: 151.218, west: 151.200 }, fillColor: '#fbbc04', fillOpacity: 0.15, strokeColor: '#fbbc04', strokeWeight: 2 }"
32- />
63+ <ScriptGoogleMapsCircle :options="circleOptions" />
64+ <ScriptGoogleMapsPolygon :options="polygonOptions" />
65+ <ScriptGoogleMapsPolyline :options="polylineOptions" />
66+ <ScriptGoogleMapsRectangle :options="rectangleOptions" />
3367 </ScriptGoogleMaps>
3468</template>
3569```
@@ -41,20 +75,24 @@ All shape components are placed inside `<ScriptGoogleMaps>`{lang="html"} and acc
4175## Circle: Delivery Radius
4276
4377``` vue
78+ <script setup lang="ts">
79+ const center = { lat: -33.8688, lng: 151.2093 }
80+
81+ const circleOptions = {
82+ center,
83+ radius: 2000,
84+ fillColor: '#4285F4',
85+ fillOpacity: 0.15,
86+ strokeColor: '#4285F4',
87+ strokeOpacity: 0.8,
88+ strokeWeight: 2,
89+ }
90+ </script>
91+
4492<template>
45- <ScriptGoogleMaps :center="{ lat: -33.8688, lng: 151.2093 }" :zoom="13">
46- <ScriptGoogleMapsAdvancedMarkerElement :position="{ lat: -33.8688, lng: 151.2093 }" />
47- <ScriptGoogleMapsCircle
48- :options="{
49- center: { lat: -33.8688, lng: 151.2093 },
50- radius: 2000,
51- fillColor: '#4285F4',
52- fillOpacity: 0.15,
53- strokeColor: '#4285F4',
54- strokeOpacity: 0.8,
55- strokeWeight: 2,
56- }"
57- />
93+ <ScriptGoogleMaps :center="center" :zoom="13">
94+ <ScriptGoogleMapsAdvancedMarkerElement :position="center" />
95+ <ScriptGoogleMapsCircle :options="circleOptions" />
5896 </ScriptGoogleMaps>
5997</template>
6098```
@@ -70,19 +108,19 @@ const zoneBoundary = [
70108 { lat: -33.878, lng: 151.205 },
71109 { lat: -33.870, lng: 151.195 },
72110]
111+
112+ const polygonOptions = {
113+ paths: zoneBoundary,
114+ fillColor: '#34a853',
115+ fillOpacity: 0.2,
116+ strokeColor: '#34a853',
117+ strokeWeight: 2,
118+ }
73119</script>
74120
75121<template>
76122 <ScriptGoogleMaps :center="{ lat: -33.865, lng: 151.210 }" :zoom="14">
77- <ScriptGoogleMapsPolygon
78- :options="{
79- paths: zoneBoundary,
80- fillColor: '#34a853',
81- fillOpacity: 0.2,
82- strokeColor: '#34a853',
83- strokeWeight: 2,
84- }"
85- />
123+ <ScriptGoogleMapsPolygon :options="polygonOptions" />
86124 </ScriptGoogleMaps>
87125</template>
88126```
@@ -97,23 +135,26 @@ const routePath = [
97135 { lat: -33.8650, lng: 151.2090 },
98136 { lat: -33.8688, lng: 151.2093 },
99137]
138+
139+ const polylineOptions = {
140+ path: routePath,
141+ strokeColor: '#ea4335',
142+ strokeOpacity: 1.0,
143+ strokeWeight: 3,
144+ }
145+
146+ const startPin = { background: '#34a853' }
147+ const endPin = { background: '#ea4335' }
100148</script>
101149
102150<template>
103151 <ScriptGoogleMaps :center="{ lat: -33.862, lng: 151.212 }" :zoom="15">
104- <ScriptGoogleMapsPolyline
105- :options="{
106- path: routePath,
107- strokeColor: '#ea4335',
108- strokeOpacity: 1.0,
109- strokeWeight: 3,
110- }"
111- />
152+ <ScriptGoogleMapsPolyline :options="polylineOptions" />
112153 <ScriptGoogleMapsAdvancedMarkerElement :position="routePath[0]">
113- <ScriptGoogleMapsPinElement :options="{ background: '#34a853' } " />
154+ <ScriptGoogleMapsPinElement :options="startPin " />
114155 </ScriptGoogleMapsAdvancedMarkerElement>
115156 <ScriptGoogleMapsAdvancedMarkerElement :position="routePath[routePath.length - 1]">
116- <ScriptGoogleMapsPinElement :options="{ background: '#ea4335' } " />
157+ <ScriptGoogleMapsPinElement :options="endPin " />
117158 </ScriptGoogleMapsAdvancedMarkerElement>
118159 </ScriptGoogleMaps>
119160</template>
@@ -122,22 +163,24 @@ const routePath = [
122163## Rectangle: Bounding Box
123164
124165``` vue
166+ <script setup lang="ts">
167+ const rectangleOptions = {
168+ bounds: {
169+ north: -33.855,
170+ south: -33.875,
171+ east: 151.225,
172+ west: 151.195,
173+ },
174+ fillColor: '#fbbc04',
175+ fillOpacity: 0.15,
176+ strokeColor: '#fbbc04',
177+ strokeWeight: 2,
178+ }
179+ </script>
180+
125181<template>
126182 <ScriptGoogleMaps :center="{ lat: -33.865, lng: 151.210 }" :zoom="14">
127- <ScriptGoogleMapsRectangle
128- :options="{
129- bounds: {
130- north: -33.855,
131- south: -33.875,
132- east: 151.225,
133- west: 151.195,
134- },
135- fillColor: '#fbbc04',
136- fillOpacity: 0.15,
137- strokeColor: '#fbbc04',
138- strokeWeight: 2,
139- }"
140- />
183+ <ScriptGoogleMapsRectangle :options="rectangleOptions" />
141184 </ScriptGoogleMaps>
142185</template>
143186```
@@ -167,26 +210,38 @@ const geoJson = {
167210 },
168211 ],
169212}
213+
214+ const geoJsonStyle = {
215+ fillColor: '#4285F4',
216+ fillOpacity: 0.3,
217+ strokeColor: '#4285F4',
218+ strokeWeight: 2,
219+ }
170220</script>
171221
172222<template>
173223 <ScriptGoogleMaps :center="{ lat: -33.885, lng: 151.225 }" :zoom="13">
174- <ScriptGoogleMapsGeoJson
175- :src="geoJson"
176- :style="{ fillColor: '#4285F4', fillOpacity: 0.3, strokeColor: '#4285F4', strokeWeight: 2 }"
177- />
224+ <ScriptGoogleMapsGeoJson :src="geoJson" :style="geoJsonStyle" />
178225 </ScriptGoogleMaps>
179226</template>
180227```
181228
182229### Remote URL
183230
184231``` vue
232+ <script setup lang="ts">
233+ const geoJsonStyle = {
234+ fillColor: '#34a853',
235+ fillOpacity: 0.2,
236+ strokeWeight: 1,
237+ }
238+ </script>
239+
185240<template>
186241 <ScriptGoogleMaps :center="{ lat: -33.885, lng: 151.225 }" :zoom="10">
187242 <ScriptGoogleMapsGeoJson
188243 src="https://example.com/boundaries.geojson"
189- :style="{ fillColor: '#34a853', fillOpacity: 0.2, strokeWeight: 1 } "
244+ :style="geoJsonStyle "
190245 />
191246 </ScriptGoogleMaps>
192247</template>
0 commit comments