0.106.2 • Published 1 day ago

@blaze-cms/plugin-google-maps-fe v0.106.2

Weekly downloads
998
License
GPL-3.0
Repository
-
Last release
1 day ago

Google maps Blaze plugin

Base files for Google maps plugin in FE

Helpers

addZoomListener

This function builds the shapes array with any additional information needed from the parent (entityGroups). It calls the function setShapes while also setting the listener for the zoom_changed event so the setShapes is called again if the zoom level changes.

buildMapTypeIds

Used to configure Google maps view types. By default, this control is visible and appears in the top left corner of the map. There are toggles in admin for enabling/disabling satellite and terrain modes.

buildQuery

In this helper we take advantage of the object entityConfigs that is returned from the setEntityConfigs function. For each entity type, we read these three properties action, ids, propsQuery. We put all the entity ids in one array. We call another function that should build the query and we pass it the entity identifier, action and propsQuery so we could expect it to return something like this page: getPublishedPages(where: $where) { ${propsQuery} }. In the end we return the query that contains all the entity specific queries and the array of all the entity ids that will be passed to the query variables ({ where: { id: { _in: ids } } }) .

getImageIds

Returns an array of imageIds. It gets the imageIds from each entity type and adds it to one array and also checks if any of the entity records chosen to display (itemsToDisplay in shape) has the image set. If that is the case, add that imageId to the array as well.

getPath

Helper that receives the paths array of objects with latitude and longitude and returns an array with the correct format. Probably could be improved if the latitude & longitude were stored under the names lat, lng so there would be no need for this helper, although the field names would be abbreviations instead full descriptive names. If this change were to be made, it would require a database update of records.

setEntityConfigs

This function goes over the entityGroups array and builds an object that for each entity type sets:

  • action (for the entity type, we get the getAllPublished or getAll action)
  • propsQuery (props that will be used in the query, gets the propsToDisplay from the data summaries; it adds the url and/or imageId to the propsQuery in case the entity has the url/imageId in its properties respectively; adds the id as well so we can find specific entity record when putting shapes on map)
  • ids (gathers all the ids of the chosen entity records of that entity type)
  • imageIds (ids of images uploaded in a specific shape for that entity)

setMapOptions

Sets the map configuration based on the settings in admin. Map center, default zoom, min/max zoom etc. It also sets some custom styles.

setShapes

Function used to place shapes on the map. It is called on initial map load, if the map is in viewport so that we use the lazy loading functionality. It is also called every time the zoom level changes. For each shape it checks the min & max zoom level and if the current zoom is inside the range of that shape, the shape will be shown, otherwise no. That is also why everytime we add a shape to the map, we store the reference in the shapesArray so that we can then call the function clearShapes and remove all the shapes from the map on zoom level change.

There are 5 types of shapes we are showing on the map.

marker

First we check if the latitude & longitude are correct (they need to be numbers). For the marker it is possible to set an icon that will display instead of the default pin from Google maps. That is the iconUrl, that we set for the icon's url along with the size (can be set in admin or it will default to 50x50). We can set the label in the admin, that will display as a title on the marker when we hover over it. In all the shapes we call the addShapeListeners that will be explained further down.

polyline

Function getPath is called to get the paths in the correct format. If there is data in the array, the polyline is added to the map. setStyleOptions function is called for each shape type except marker and it's used to define custom styling to the shapes related to the stroke and fill.

polygon

Same as for polyline. The last point of the polygon doesnt need to have the same the coordinates as the first one, Google maps API will "close" the shape by default.

rectangle

For this shape, there are 4 values for each bound/corner. areRectangleBoundsNumbers checks if all of them are valid numbers and then adds the rectangle to the map along with any custom styling returned from the setStyleOptions function.

circle

First checks if the latitude and longitude of the center are correct and the value of the radius is a number, if yes - it shows the circle.


addShapeListeners

This function adds an event listener to display an info pane/window when we click on the shape, in case the enableInfoPane is set to true. If enableInfoPane is set to false and there is an url set for that entity, it should navigate to the url - when clicking on shape. When showing the info window, first it will close any already opened info window. That way it prevents that multiple info windows are open and that they overlap. In the Info window we display an image if the chosen entity record for the shape has an image set and the data summaries added through admin. The image and the data summary of type heading large will be links with url in case the entity has the url (valid for publishable entities).

0.106.1

2 days ago

0.106.2

2 days ago

0.106.0

4 days ago

0.106.0-alpha.0

6 days ago

0.105.1

8 days ago

0.105.0-alpha.7

8 days ago

0.105.0-alpha.6

9 days ago

0.105.0-alpha.4

10 days ago

0.105.0

8 days ago

0.104.1

15 days ago

0.104.2

15 days ago

0.105.0-alpha.1

14 days ago

0.105.0-alpha.0

15 days ago

0.104.0

16 days ago

0.104.0-alpha.5

16 days ago

0.104.0-alpha.3

21 days ago

0.104.0-alpha.2

21 days ago

0.104.0-alpha.1

21 days ago

0.104.0-alpha.0

21 days ago

0.104.0-alpha.4

21 days ago

0.103.0

23 days ago

0.103.0-alpha.6

1 month ago

0.103.0-alpha.3

1 month ago

0.102.2

1 month ago

0.103.0-alpha.2

1 month ago

0.103.0-alpha.1

1 month ago

0.102.0

2 months ago

0.101.2

2 months ago

0.102.0-alpha.2

2 months ago

0.102.0-alpha.0

2 months ago

0.101.0

2 months ago

0.101.0-alpha.3

2 months ago

0.101.0-alpha.1

2 months ago

0.101.0-alpha.0

3 months ago

0.100.0

3 months ago

0.100.0-alpha.4

3 months ago

0.99.0

3 months ago

0.100.0-alpha.2

3 months ago

0.100.0-alpha.0

3 months ago

0.100.0-alpha.1

3 months ago

0.99.0-alpha.1

3 months ago

0.99.0-alpha.0

3 months ago

0.98.0

3 months ago

0.98.0-alpha.1

3 months ago

0.98.0-alpha.0

3 months ago

0.97.3

3 months ago

0.97.3-alpha.1

3 months ago

0.97.3-alpha.0

3 months ago

0.97.0-alpha.16

4 months ago

0.97.0-alpha.12

4 months ago

0.97.0-alpha.15

4 months ago

0.97.0-alpha.11

4 months ago

0.97.0-alpha.10

4 months ago

0.97.2-alpha.2

3 months ago

0.97.2-alpha.0

4 months ago

0.97.0

4 months ago

0.97.0-alpha.8

4 months ago

0.97.0-alpha.7

4 months ago

0.97.0-alpha.6

4 months ago

0.97.0-alpha.5

4 months ago

0.97.0-alpha.4

4 months ago

0.97.0-alpha.3

4 months ago

0.97.0-alpha.2

4 months ago

0.97.0-alpha.1

4 months ago

0.97.0-alpha.0

4 months ago

0.96.0

4 months ago

0.94.0

5 months ago

0.95.1-alpha.0

5 months ago

0.95.1-alpha.2

5 months ago

0.95.0

5 months ago

0.95.0-alpha.0

5 months ago

0.96.0-alpha.0

5 months ago

0.96.0-alpha.1

4 months ago

0.96.0-alpha.3

4 months ago

0.94.1-alpha.1

5 months ago

0.94.1-alpha.0

5 months ago

0.94.0-alpha.5

5 months ago

0.94.0-alpha.0

6 months ago

0.93.0

6 months ago

0.93.0-alpha.0

6 months ago

0.92.2

6 months ago

0.92.2-alpha.0

6 months ago

0.92.1

7 months ago

0.92.1-alpha.0

7 months ago

0.92.0

7 months ago

0.92.0-alpha.2

7 months ago

0.92.0-alpha.1

7 months ago

0.92.0-alpha.0

7 months ago

0.91.0

7 months ago

0.91.0-alpha.1

7 months ago

0.91.0-alpha.0

7 months ago

0.90.0

7 months ago

0.90.0-alpha.0

7 months ago

0.89.0

7 months ago

0.89.0-alpha.0

7 months ago

0.88.0

8 months ago

0.87.0

8 months ago

0.87.0-alpha.1

8 months ago

0.87.0-alpha.0

8 months ago

0.86.0-alpha.0

8 months ago

0.85.0-alpha.0

8 months ago

0.84.0-alpha.0

8 months ago

0.83.2-alpha.0

8 months ago

0.83.1-alpha.0

8 months ago

0.83.0-alpha.0

8 months ago

0.82.0-alpha.0

8 months ago

0.81.1-alpha.0

9 months ago

0.80.0-alpha.0

9 months ago

0.78.2-alpha.0

9 months ago

0.79.0-alpha.0

9 months ago

0.78.1-alpha.0

9 months ago

0.78.0-alpha.0

9 months ago

0.76.0-alpha.0

10 months ago

0.74.1-alpha.0

10 months ago

0.74.0-alpha.0

10 months ago

0.73.0-alpha.0

10 months ago

0.72.0-alpha.0

10 months ago

0.71.2-alpha.0

10 months ago

0.71.1-alpha.0

10 months ago

0.70.2-alpha.0

10 months ago

0.70.1-alpha.0

10 months ago

0.70.0-alpha.0

10 months ago

0.69.0-alpha.0

10 months ago

0.68.5-alpha.0

10 months ago

0.68.3-alpha.0

11 months ago

0.68.1-alpha.0

11 months ago

0.68.2-alpha.0

11 months ago

0.68.0-alpha.0

11 months ago

0.67.0-alpha.0

11 months ago

0.66.0-alpha.0

11 months ago

0.64.0-alpha.0

11 months ago

0.63.0-alpha.0

11 months ago

0.62.0-alpha.0

11 months ago

0.59.5-alpha.0

11 months ago

0.61.0-alpha.0

11 months ago

0.60.0-alpha.0

11 months ago

0.59.4-alpha.0

11 months ago

0.59.1-alpha.0

11 months ago

0.58.3-alpha.0

11 months ago

0.58.1-alpha.0

11 months ago

0.58.2-alpha.0

11 months ago

0.57.0-alpha.0

11 months ago

0.55.0-alpha.0

11 months ago

0.54.1-alpha.0

11 months ago

0.54.0-alpha.0

12 months ago

0.53.2-alpha.0

12 months ago

0.53.3-alpha.0

12 months ago

0.53.0-alpha.0

12 months ago

0.53.1-alpha.0

12 months ago

0.52.0-alpha.0

12 months ago

0.51.0-alpha.0

12 months ago

0.50.0-alpha.0

12 months ago

0.49.3-alpha.0

12 months ago

0.49.2-alpha.0

12 months ago

0.49.1-alpha.0

12 months ago

0.49.0-alpha.0

12 months ago

0.48.1-alpha.0

12 months ago

0.48.0-alpha.0

12 months ago

0.47.0-alpha.0

1 year ago

0.46.1-alpha.0

1 year ago

0.46.0-alpha.0

1 year ago

0.45.2-alpha.0

1 year ago

0.45.1-alpha.0

1 year ago

0.44.2-alpha.0

1 year ago

0.44.1-alpha.0

1 year ago

0.43.1-alpha.0

1 year ago

0.43.0-alpha.0

1 year ago

0.42.4-alpha.0

1 year ago

0.42.1-alpha.0

1 year ago

0.42.0-alpha.0

1 year ago

0.41.2-alpha.0

1 year ago

0.41.1-alpha.0

1 year ago

0.41.0-alpha.0

1 year ago

0.40.2-alpha.0

1 year ago

0.40.1-alpha.0

1 year ago

0.40.0-alpha.0

1 year ago

0.39.18-alpha.0

1 year ago

0.39.17-alpha.0

1 year ago

0.39.16-alpha.0

1 year ago

0.39.14-alpha.0

1 year ago

0.39.11-alpha.0

1 year ago

0.39.13-alpha.0

1 year ago

0.39.12-alpha.0

1 year ago

0.39.10-alpha.0

1 year ago

0.39.9-alpha.0

1 year ago

0.39.8-alpha.0

1 year ago

0.39.7-alpha.0

1 year ago

0.39.6-alpha.0

1 year ago

0.39.4-alpha.0

1 year ago

0.39.3-alpha.0

1 year ago

0.39.2-alpha.0

1 year ago

0.38.7-alpha.0

1 year ago

0.38.5-alpha.0

1 year ago

0.38.6-alpha.0

1 year ago

0.38.4-alpha.0

1 year ago

0.38.3-alpha.0

1 year ago

0.38.1-alpha.0

1 year ago

0.38.0-alpha.0

1 year ago

0.37.53-alpha.0

1 year ago

0.37.54-alpha.0

1 year ago

0.37.51-alpha.0

1 year ago

0.37.52-alpha.0

1 year ago

0.37.48-alpha.0

1 year ago

0.37.46-alpha.0

1 year ago

0.37.45-alpha.0

1 year ago

0.37.44-alpha.0

1 year ago

0.37.41-alpha.0

1 year ago

0.37.42-alpha.0

1 year ago

0.37.40-alpha.0

1 year ago

0.37.39-alpha.0

1 year ago

0.37.38-alpha.0

1 year ago

0.37.37-alpha.0

1 year ago

0.37.36-alpha.0

1 year ago

0.37.35-alpha.0

1 year ago

0.37.33-alpha.0

1 year ago

0.37.32-alpha.0

1 year ago

0.37.31-alpha.0

1 year ago

0.37.29-alpha.0

1 year ago

0.37.28-alpha.0

1 year ago

0.37.27-alpha.0

1 year ago

0.37.26-alpha.0

1 year ago

0.37.24-alpha.0

1 year ago

0.37.23-alpha.0

1 year ago

0.37.22-alpha.0

1 year ago

0.37.21-alpha.0

1 year ago

0.37.19-alpha.0

1 year ago

0.37.20-alpha.0

1 year ago

0.37.18-alpha.0

1 year ago

0.37.17-alpha.0

1 year ago

0.37.16-alpha.0

1 year ago

0.37.15-alpha.0

1 year ago

0.37.14-alpha.0

1 year ago

0.37.13-alpha.0

1 year ago

0.37.12-alpha.0

1 year ago

0.37.11-alpha.0

1 year ago

0.37.10-alpha.0

1 year ago

0.37.8-alpha.0

1 year ago

0.37.7-alpha.0

1 year ago

0.37.6-alpha.0

1 year ago

0.37.5-alpha.0

1 year ago