@lowdefy/blocks-google-maps 0.0.0-experimental-20231123101256
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +525 -0
- package/dist/blocks/GoogleMaps/GoogleMaps.js +30 -0
- package/dist/blocks/GoogleMaps/GoogleMaps.json +207 -0
- package/dist/blocks/GoogleMapsHeatmap/GoogleMapsHeatmap.js +50 -0
- package/dist/blocks/GoogleMapsHeatmap/GoogleMapsHeatmap.json +135 -0
- package/dist/blocks/GoogleMapsScript/GoogleMapsScript.js +44 -0
- package/dist/blocks/GoogleMapsScript/GoogleMapsScript.json +28 -0
- package/dist/blocks/Map.js +187 -0
- package/dist/blocks.js +17 -0
- package/dist/types.js +29 -0
- package/package.json +66 -0
package/README.md
ADDED
|
@@ -0,0 +1,525 @@
|
|
|
1
|
+
# Lowdefy Google Maps Blocks
|
|
2
|
+
|
|
3
|
+
This is a Lowdefy blocks wrapper for this the [Google Maps API](https://developers.google.com/maps/documentation/javascript/overview).
|
|
4
|
+
|
|
5
|
+
To use this block, define a [@googlemaps/react-wrapper](https://www.npmjs.com/package/@googlemaps/react-wrapper). It currently implements:
|
|
6
|
+
|
|
7
|
+
- [Map](https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions)
|
|
8
|
+
- [Heatmap](https://developers.google.com/maps/documentation/javascript/reference/visualization#HeatmapLayerOptions)
|
|
9
|
+
- [Markers](https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions)
|
|
10
|
+
- [Marker Clusterers](https://developers.google.com/maps/documentation/javascript/marker-clustering)
|
|
11
|
+
|
|
12
|
+
### Properties
|
|
13
|
+
|
|
14
|
+
- `apiKey: string`: Your Google Maps API key.
|
|
15
|
+
- `libraries: array`: List of [Google libraries](https://developers.google.com/maps/documentation/javascript/libraries).
|
|
16
|
+
- `map: mapOptions`: All [map options](https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions).
|
|
17
|
+
- `center: { lat: number, lng: number }`: A coordinate position object by which to center the map.
|
|
18
|
+
- `zoom: number`: Map zoom level.
|
|
19
|
+
- `options: mapOptions`: All other [map options](https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions).
|
|
20
|
+
- `heatmap: heatmapOptions`: Add a heatmap layer, see more [heatmap options](https://developers.google.com/maps/documentation/javascript/reference/visualization#HeatmapLayerOptions). This will automatically load the `visualization` library, which must be added to the list of libraries in the `libraries` property of the `GoogleMapsScript` block.
|
|
21
|
+
- `data: { lat: number, lng: number, weight: number } []`: A list of heatmap data points.
|
|
22
|
+
- `style: cssObject`: A style object applied to the map element.
|
|
23
|
+
- `markers: markerOptions[]`: A list of Markers with marker options, see more [Javascript API Markers](https://developers.google.com/maps/documentation/javascript/markers).
|
|
24
|
+
- `position: { lat: number, lng: number }`: Position of marker on map.
|
|
25
|
+
- `label: string`: Label displayed on marker.
|
|
26
|
+
- `markerClusterers: markerClustererOptions[]`: A list of MarkerClusterers with marker clusterer options.
|
|
27
|
+
- `markers: markerOptions[]`: A list of Markers with marker options, see more [Javascript API Markers](https://developers.google.com/maps/documentation/javascript/markers).
|
|
28
|
+
- `position: { lat: number, lng: number }`: Position of marker on map.
|
|
29
|
+
- `label: string`: Label displayed on marker.
|
|
30
|
+
- `options: markerClustererOptions`: All other [marker clusterer options](https://react-google-maps-api-docs.netlify.app/#markerclusterer).
|
|
31
|
+
- `infoWindow: infoWindowOptions`: All infoWindow options, see [infoWindow options](https://developers.google.com/maps/documentation/javascript/reference/info-window#InfoWindowOptions).
|
|
32
|
+
- `position: { lat: number, lng: number }`: Position of infoWindow on map.
|
|
33
|
+
- `visible: boolean`: When visible is true, blocks inside infoWindow content area will be rendered.
|
|
34
|
+
|
|
35
|
+
### Events
|
|
36
|
+
|
|
37
|
+
- `onBoundsChanged`: Trigger onBoundsChanged actions when the bounds of the map are changed, returns `_event`
|
|
38
|
+
object:
|
|
39
|
+
- `bounds`:
|
|
40
|
+
- `east`: latitudinal coordinate
|
|
41
|
+
- `north`: longitudinal coordinate
|
|
42
|
+
- `south`: longitudinal coordinate
|
|
43
|
+
- `west`: latitudinal coordinate
|
|
44
|
+
- `center`:
|
|
45
|
+
- `lat`: latitudinal coordinate
|
|
46
|
+
- `lng`: longitudinal coordinate
|
|
47
|
+
- `zoom`: zoom level
|
|
48
|
+
- `onCenterChanged`: Trigger onCenterChanged actions when the center of the map is changed, returns `_event`
|
|
49
|
+
object:
|
|
50
|
+
- `bounds`:
|
|
51
|
+
- `east`: latitudinal coordinate
|
|
52
|
+
- `north`: longitudinal coordinate
|
|
53
|
+
- `south`: longitudinal coordinate
|
|
54
|
+
- `west`: latitudinal coordinate
|
|
55
|
+
- `center`:
|
|
56
|
+
- `lat`: latitudinal coordinate
|
|
57
|
+
- `lng`: longitudinal coordinate
|
|
58
|
+
- `zoom`: zoom level
|
|
59
|
+
- `onClick`: Trigger onClick actions when the map is clicked, returns `_event` object:
|
|
60
|
+
- `domEvent`: event object
|
|
61
|
+
- `latLng`:
|
|
62
|
+
- `lat`: latitudinal coordinate
|
|
63
|
+
- `lng`: longitudinal coordinate
|
|
64
|
+
- `pixel`:
|
|
65
|
+
- `x`: x position on map block
|
|
66
|
+
- `y`: y position on map block
|
|
67
|
+
- `onClusterClick`: Trigger onClusterClick actions when a cluster is clicked, returns `_event`
|
|
68
|
+
- `onMarkerClick`: Trigger onMarkerClick actions when a marker is clicked, returns `_event`
|
|
69
|
+
object:
|
|
70
|
+
- `domEvent`: event object
|
|
71
|
+
- `latLng`:
|
|
72
|
+
- `lat`: latitudinal coordinate
|
|
73
|
+
- `lng`: longitudinal coordinate
|
|
74
|
+
- `pixel`:
|
|
75
|
+
- `x`: x position on map block
|
|
76
|
+
- `y`: y position on map block
|
|
77
|
+
- `onZoomChanged`: Trigger onZoomChanged actions when the zoom on the map is changed. returns `_event`
|
|
78
|
+
object:
|
|
79
|
+
- `bounds`:
|
|
80
|
+
- `east`: latitudinal coordinate
|
|
81
|
+
- `north`: longitudinal coordinate
|
|
82
|
+
- `south`: longitudinal coordinate
|
|
83
|
+
- `west`: latitudinal coordinate
|
|
84
|
+
- `center`:
|
|
85
|
+
- `lat`: latitudinal coordinate
|
|
86
|
+
- `lng`: longitudinal coordinate
|
|
87
|
+
- `zoom`: zoom level
|
|
88
|
+
|
|
89
|
+
### Methods
|
|
90
|
+
|
|
91
|
+
- `fitBounds`: Fit map to given bounds.
|
|
92
|
+
- `bounds: { lat: number, lng: number } []`: A list of the coordinate positions of the boundary points.
|
|
93
|
+
- `zoom: number`: Map zoom level.
|
|
94
|
+
- `getBounds`: Returns the bounds of the map.
|
|
95
|
+
- `getCenter`: Returns the center of the map.
|
|
96
|
+
- `getZoom`: Returns the zoom of the map.
|
|
97
|
+
|
|
98
|
+
## Examples
|
|
99
|
+
|
|
100
|
+
1. Add markers:
|
|
101
|
+
|
|
102
|
+
```yaml
|
|
103
|
+
- id: google_maps_script_1
|
|
104
|
+
type: GoogleMapsScript
|
|
105
|
+
properties:
|
|
106
|
+
apiKey:
|
|
107
|
+
_build.env: GOOGLE_MAPS_API_KEY
|
|
108
|
+
blocks:
|
|
109
|
+
- id: google_maps_1
|
|
110
|
+
type: GoogleMaps
|
|
111
|
+
properties:
|
|
112
|
+
map:
|
|
113
|
+
options:
|
|
114
|
+
panControl: true
|
|
115
|
+
zoomControl: true
|
|
116
|
+
fullscreenControl: true
|
|
117
|
+
zoom: 14
|
|
118
|
+
center:
|
|
119
|
+
lat: -25.344
|
|
120
|
+
lng: 131.036
|
|
121
|
+
markers:
|
|
122
|
+
- position:
|
|
123
|
+
lat: -25.344
|
|
124
|
+
lng: 131.036
|
|
125
|
+
label: One
|
|
126
|
+
- position:
|
|
127
|
+
lat: -25.348
|
|
128
|
+
lng: 131.038
|
|
129
|
+
label: Two
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
2. Automatically bound map around marker positions when zoom and center map properties are left out:
|
|
133
|
+
|
|
134
|
+
```yaml
|
|
135
|
+
- id: google_maps_script_2
|
|
136
|
+
type: GoogleMapsScript
|
|
137
|
+
properties:
|
|
138
|
+
apiKey:
|
|
139
|
+
_build.env: GOOGLE_MAPS_API_KEY
|
|
140
|
+
blocks:
|
|
141
|
+
- id: google_maps_2
|
|
142
|
+
type: GoogleMaps
|
|
143
|
+
properties:
|
|
144
|
+
map:
|
|
145
|
+
options:
|
|
146
|
+
panControl: true
|
|
147
|
+
zoomControl: true
|
|
148
|
+
fullscreenControl: true
|
|
149
|
+
markers:
|
|
150
|
+
- position:
|
|
151
|
+
lat: -25.344
|
|
152
|
+
lng: 131.036
|
|
153
|
+
label: One
|
|
154
|
+
- position:
|
|
155
|
+
lat: -25.348
|
|
156
|
+
lng: 131.038
|
|
157
|
+
label: Two
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
3. Add tooltips by making use of infoWindow:
|
|
161
|
+
|
|
162
|
+
```yaml
|
|
163
|
+
- id: google_maps_script_3
|
|
164
|
+
type: GoogleMapsScript
|
|
165
|
+
properties:
|
|
166
|
+
apiKey:
|
|
167
|
+
_build.env: GOOGLE_MAPS_API_KEY
|
|
168
|
+
blocks:
|
|
169
|
+
- id: google_maps_3
|
|
170
|
+
type: GoogleMaps
|
|
171
|
+
properties:
|
|
172
|
+
map:
|
|
173
|
+
options:
|
|
174
|
+
panControl: true
|
|
175
|
+
zoomControl: true
|
|
176
|
+
fullscreenControl: true
|
|
177
|
+
zoom: 14
|
|
178
|
+
center:
|
|
179
|
+
lat: -25.344
|
|
180
|
+
lng: 131.036
|
|
181
|
+
markers:
|
|
182
|
+
- position:
|
|
183
|
+
lat: -25.344
|
|
184
|
+
lng: 131.036
|
|
185
|
+
label: One
|
|
186
|
+
- position:
|
|
187
|
+
lat: -25.348
|
|
188
|
+
lng: 131.038
|
|
189
|
+
label: Two
|
|
190
|
+
infoWindow:
|
|
191
|
+
position:
|
|
192
|
+
_state: position
|
|
193
|
+
visible:
|
|
194
|
+
_state: show_info
|
|
195
|
+
events:
|
|
196
|
+
onMarkerClick:
|
|
197
|
+
- id: set
|
|
198
|
+
type: SetState
|
|
199
|
+
params:
|
|
200
|
+
show_info:
|
|
201
|
+
_not:
|
|
202
|
+
_state: show_info
|
|
203
|
+
position:
|
|
204
|
+
_event: latLng
|
|
205
|
+
areas:
|
|
206
|
+
infoWindow:
|
|
207
|
+
blocks:
|
|
208
|
+
- id: content
|
|
209
|
+
type: Html
|
|
210
|
+
properties:
|
|
211
|
+
html:
|
|
212
|
+
_nunjucks:
|
|
213
|
+
template: |
|
|
214
|
+
<h1>Lat: {{ position.lat }} Lng: {{ position.lng }} </h1>
|
|
215
|
+
on:
|
|
216
|
+
_state: true
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
4. Add markers with onClick event:
|
|
220
|
+
|
|
221
|
+
```yaml
|
|
222
|
+
- id: google_maps_script_4
|
|
223
|
+
type: GoogleMapsScript
|
|
224
|
+
properties:
|
|
225
|
+
apiKey:
|
|
226
|
+
_build.env: GOOGLE_MAPS_API_KEY
|
|
227
|
+
blocks:
|
|
228
|
+
- id: google_maps_4
|
|
229
|
+
type: GoogleMaps
|
|
230
|
+
properties:
|
|
231
|
+
map:
|
|
232
|
+
options:
|
|
233
|
+
panControl: true
|
|
234
|
+
zoomControl: true
|
|
235
|
+
fullscreenControl: true
|
|
236
|
+
center:
|
|
237
|
+
lat: -25.344
|
|
238
|
+
lng: 131.036
|
|
239
|
+
zoom: 5
|
|
240
|
+
markers:
|
|
241
|
+
_state: markers_list
|
|
242
|
+
events:
|
|
243
|
+
onClick:
|
|
244
|
+
- id: markers_list
|
|
245
|
+
type: SetState
|
|
246
|
+
params:
|
|
247
|
+
markers_list:
|
|
248
|
+
_array.concat:
|
|
249
|
+
- - position:
|
|
250
|
+
_event: latLng
|
|
251
|
+
label: Hi
|
|
252
|
+
- _if_none:
|
|
253
|
+
- _state: markers_list
|
|
254
|
+
- []
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
5. Add a heatmap:
|
|
258
|
+
|
|
259
|
+
```yaml
|
|
260
|
+
- id: google_maps_script_5
|
|
261
|
+
type: GoogleMapsScript
|
|
262
|
+
properties:
|
|
263
|
+
libraries:
|
|
264
|
+
- visualization
|
|
265
|
+
apiKey:
|
|
266
|
+
_build.env: GOOGLE_MAPS_API_KEY
|
|
267
|
+
blocks:
|
|
268
|
+
- id: google_maps_5
|
|
269
|
+
type: GoogleMapsHeatmap
|
|
270
|
+
properties:
|
|
271
|
+
map:
|
|
272
|
+
disableDefaultUI: true
|
|
273
|
+
heatmap:
|
|
274
|
+
data:
|
|
275
|
+
- lat: 34.091158
|
|
276
|
+
lng: -118.2795188
|
|
277
|
+
weight: 1
|
|
278
|
+
- lat: 34.0771192
|
|
279
|
+
lng: -118.2587199
|
|
280
|
+
weight: 2
|
|
281
|
+
- lat: 34.083527
|
|
282
|
+
lng: -118.370157
|
|
283
|
+
weight: 1
|
|
284
|
+
- lat: 34.0951843
|
|
285
|
+
lng: -118.283107
|
|
286
|
+
weight: 2
|
|
287
|
+
- lat: 34.1033401
|
|
288
|
+
lng: -118.2875469
|
|
289
|
+
weight: 4
|
|
290
|
+
- lat: 34.035798
|
|
291
|
+
lng: -118.251288
|
|
292
|
+
weight: 2
|
|
293
|
+
- lat: 34.0776068
|
|
294
|
+
lng: -118.2646526
|
|
295
|
+
weight: 3
|
|
296
|
+
- lat: 34.0919263
|
|
297
|
+
lng: -118.2820544
|
|
298
|
+
weight: 3
|
|
299
|
+
- lat: 34.0568525
|
|
300
|
+
lng: -118.3646369
|
|
301
|
+
weight: 3
|
|
302
|
+
- lat: 34.0285781
|
|
303
|
+
lng: -118.4115541
|
|
304
|
+
weight: 0
|
|
305
|
+
- lat: 34.017339
|
|
306
|
+
lng: -118.278469
|
|
307
|
+
weight: 0
|
|
308
|
+
- lat: 34.0764288
|
|
309
|
+
lng: -118.3661624
|
|
310
|
+
weight: 4
|
|
311
|
+
- lat: 33.9925942
|
|
312
|
+
lng: -118.4232475
|
|
313
|
+
weight: 4
|
|
314
|
+
- lat: 34.0764345
|
|
315
|
+
lng: -118.3730332
|
|
316
|
+
weight: 3
|
|
317
|
+
- lat: 34.093981
|
|
318
|
+
lng: -118.327638
|
|
319
|
+
weight: 0
|
|
320
|
+
- lat: 34.056385
|
|
321
|
+
lng: -118.2508724
|
|
322
|
+
weight: 1
|
|
323
|
+
- lat: 34.107701
|
|
324
|
+
lng: -118.2667943
|
|
325
|
+
weight: 4
|
|
326
|
+
- lat: 34.0450139
|
|
327
|
+
lng: -118.2388682
|
|
328
|
+
weight: 4
|
|
329
|
+
- lat: 34.1031997
|
|
330
|
+
lng: -118.2586152
|
|
331
|
+
weight: 1
|
|
332
|
+
- lat: 34.0828183
|
|
333
|
+
lng: -118.3241586
|
|
334
|
+
weight: 1
|
|
335
|
+
options:
|
|
336
|
+
radius: 20
|
|
337
|
+
opacity: 1
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
6. Trigger fitBounds using a Button:
|
|
341
|
+
|
|
342
|
+
```yaml
|
|
343
|
+
- id: google_maps_script_6
|
|
344
|
+
type: GoogleMapsScript
|
|
345
|
+
properties:
|
|
346
|
+
apiKey:
|
|
347
|
+
_build.env: GOOGLE_MAPS_API_KEY
|
|
348
|
+
blocks:
|
|
349
|
+
- id: btn
|
|
350
|
+
type: Button
|
|
351
|
+
events:
|
|
352
|
+
onClick:
|
|
353
|
+
- id: set_boundaries
|
|
354
|
+
type: CallMethod
|
|
355
|
+
params:
|
|
356
|
+
blockId: google_maps_6
|
|
357
|
+
method: fitBounds
|
|
358
|
+
args:
|
|
359
|
+
- bounds:
|
|
360
|
+
- lat: -25.344
|
|
361
|
+
lng: 131.036
|
|
362
|
+
- lat: -25.348
|
|
363
|
+
lng: 131.038
|
|
364
|
+
zoom: 10
|
|
365
|
+
|
|
366
|
+
- id: google_maps_6
|
|
367
|
+
type: GoogleMaps
|
|
368
|
+
properties:
|
|
369
|
+
map:
|
|
370
|
+
zoom: 5
|
|
371
|
+
center:
|
|
372
|
+
lat: -35.344
|
|
373
|
+
lng: 31.036
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
7. Add a marker clusterer:
|
|
377
|
+
|
|
378
|
+
```yaml
|
|
379
|
+
- id: google_maps_script_7
|
|
380
|
+
type: GoogleMapsScript
|
|
381
|
+
properties:
|
|
382
|
+
libraries:
|
|
383
|
+
- visualization
|
|
384
|
+
apiKey:
|
|
385
|
+
_build.env: GOOGLE_MAPS_API_KEY
|
|
386
|
+
blocks:
|
|
387
|
+
- id: google_maps_7
|
|
388
|
+
type: GoogleMaps
|
|
389
|
+
properties:
|
|
390
|
+
map:
|
|
391
|
+
disableDefaultUI: true
|
|
392
|
+
markerClusterers:
|
|
393
|
+
- markers:
|
|
394
|
+
- position:
|
|
395
|
+
lat: 34.091158
|
|
396
|
+
lng: -118.2795188
|
|
397
|
+
- position:
|
|
398
|
+
lat: 34.0771192
|
|
399
|
+
lng: -118.2587199
|
|
400
|
+
- position:
|
|
401
|
+
lat: 34.083527
|
|
402
|
+
lng: -118.370157
|
|
403
|
+
- position:
|
|
404
|
+
lat: 34.0951843
|
|
405
|
+
lng: -118.283107
|
|
406
|
+
- position:
|
|
407
|
+
lat: 34.1033401
|
|
408
|
+
lng: -118.2875469
|
|
409
|
+
- position:
|
|
410
|
+
lat: 34.035798
|
|
411
|
+
lng: -118.251288
|
|
412
|
+
- position:
|
|
413
|
+
lat: 34.0776068
|
|
414
|
+
lng: -118.2646526
|
|
415
|
+
- position:
|
|
416
|
+
lat: 34.0919263
|
|
417
|
+
lng: -118.2820544
|
|
418
|
+
- position:
|
|
419
|
+
lat: 34.0568525
|
|
420
|
+
lng: -118.3646369
|
|
421
|
+
- position:
|
|
422
|
+
lat: 34.0285781
|
|
423
|
+
lng: -118.4115541
|
|
424
|
+
- position:
|
|
425
|
+
lat: 34.017339
|
|
426
|
+
lng: -118.278469
|
|
427
|
+
- position:
|
|
428
|
+
lat: 34.0764288
|
|
429
|
+
lng: -118.3661624
|
|
430
|
+
- position:
|
|
431
|
+
lat: 33.9925942
|
|
432
|
+
lng: -118.4232475
|
|
433
|
+
- position:
|
|
434
|
+
lat: 34.0764345
|
|
435
|
+
lng: -118.3730332
|
|
436
|
+
- position:
|
|
437
|
+
lat: 34.093981
|
|
438
|
+
lng: -118.327638
|
|
439
|
+
- position:
|
|
440
|
+
lat: 34.056385
|
|
441
|
+
lng: -118.2508724
|
|
442
|
+
- position:
|
|
443
|
+
lat: 34.107701
|
|
444
|
+
lng: -118.2667943
|
|
445
|
+
- position:
|
|
446
|
+
lat: 34.0450139
|
|
447
|
+
lng: -118.2388682
|
|
448
|
+
- position:
|
|
449
|
+
lat: 34.1031997
|
|
450
|
+
lng: -118.2586152
|
|
451
|
+
- position:
|
|
452
|
+
lat: 34.0828183
|
|
453
|
+
lng: -118.3241586
|
|
454
|
+
options:
|
|
455
|
+
averageCenter: true
|
|
456
|
+
zoomOnClick: false
|
|
457
|
+
minimumClusterSize: 3
|
|
458
|
+
maxZoom: 13
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
8. Call method getZoom:
|
|
462
|
+
|
|
463
|
+
```yaml
|
|
464
|
+
- id: google_maps_script_8
|
|
465
|
+
type: GoogleMapsScript
|
|
466
|
+
properties:
|
|
467
|
+
apiKey:
|
|
468
|
+
_build.env: GOOGLE_MAPS_API_KEY
|
|
469
|
+
blocks:
|
|
470
|
+
- id: google_maps_8
|
|
471
|
+
type: GoogleMaps
|
|
472
|
+
properties:
|
|
473
|
+
map:
|
|
474
|
+
options:
|
|
475
|
+
panControl: true
|
|
476
|
+
zoomControl: true
|
|
477
|
+
fullscreenControl: true
|
|
478
|
+
zoom: 14
|
|
479
|
+
center:
|
|
480
|
+
lat: -25.344
|
|
481
|
+
lng: 131.036
|
|
482
|
+
events:
|
|
483
|
+
onClick:
|
|
484
|
+
- id: get_zoom
|
|
485
|
+
type: CallMethod
|
|
486
|
+
params:
|
|
487
|
+
blockId: google_maps_8
|
|
488
|
+
method: getZoom
|
|
489
|
+
- id: get_zoom_result
|
|
490
|
+
type: SetState
|
|
491
|
+
params:
|
|
492
|
+
zoom:
|
|
493
|
+
_actions: get_zoom.response
|
|
494
|
+
```
|
|
495
|
+
<!--
|
|
496
|
+
7. Trigger fitBounds using the onLoad event:
|
|
497
|
+
|
|
498
|
+
```yaml
|
|
499
|
+
- id: google_maps_script_7
|
|
500
|
+
type: GoogleMapsScript
|
|
501
|
+
properties:
|
|
502
|
+
apiKey:
|
|
503
|
+
_build.env: GOOGLE_MAPS_API_KEY
|
|
504
|
+
blocks:
|
|
505
|
+
- id: google_maps_7
|
|
506
|
+
type: GoogleMaps
|
|
507
|
+
properties:
|
|
508
|
+
map:
|
|
509
|
+
zoom: 5
|
|
510
|
+
center:
|
|
511
|
+
lat: -35.344
|
|
512
|
+
lng: 31.036
|
|
513
|
+
events:
|
|
514
|
+
onLoad:
|
|
515
|
+
- id: set_boundaries
|
|
516
|
+
type: CallMethod
|
|
517
|
+
params:
|
|
518
|
+
blockId: google_maps_7
|
|
519
|
+
method: fitBounds
|
|
520
|
+
args:
|
|
521
|
+
- bounds:
|
|
522
|
+
- lat: -25.344
|
|
523
|
+
lng: 131.036
|
|
524
|
+
zoom: 10
|
|
525
|
+
``` -->
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import React from 'react';
|
|
16
|
+
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
17
|
+
import Map from '../Map.js';
|
|
18
|
+
const GoogleMaps = ({ blockId, content, methods, properties })=>/*#__PURE__*/ React.createElement(Map, {
|
|
19
|
+
blockId: blockId,
|
|
20
|
+
content: content,
|
|
21
|
+
methods: methods,
|
|
22
|
+
properties: properties
|
|
23
|
+
});
|
|
24
|
+
GoogleMaps.defaultProps = blockDefaultProps;
|
|
25
|
+
GoogleMaps.meta = {
|
|
26
|
+
category: 'container',
|
|
27
|
+
icons: [],
|
|
28
|
+
styles: []
|
|
29
|
+
};
|
|
30
|
+
export default GoogleMaps;
|