From 2f18a996546e21f599af17f44fb4949aa3bbd40c Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Mon, 3 Apr 2023 11:59:50 +0200 Subject: [PATCH 1/3] maint: Explicitly set the module federation bundle name for clarity. --- webpack.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/webpack.config.js b/webpack.config.js index de4b249..64e3461 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -27,6 +27,7 @@ module.exports = () => { config.plugins.push( mf_config({ name: package_json.name, + filename: "remote.min.js", remote_entry: config.entry["bundle.min"], dependencies: { ...package_json_patternslib.dependencies, From 24ac976ce15f36d53f1e0d83bd54f90bd485e53c Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Mon, 3 Apr 2023 12:00:38 +0200 Subject: [PATCH 2/3] maint: Update documentation. --- src/documentation.md | 62 +++++++++++++++++++++++++++++--------------- src/index.html | 33 +++++++++++++---------- 2 files changed, 60 insertions(+), 35 deletions(-) diff --git a/src/documentation.md b/src/documentation.md index 2a3990d..1cc78e2 100644 --- a/src/documentation.md +++ b/src/documentation.md @@ -2,30 +2,50 @@ ## Description -Implements `Leaflet.js` with various options. +Implements [Leaflet.js](https://leafletjs.com/) with various options. + ## Documentation -A more detailed documentation on how to use it goes here. +Example usage: + +``` +
+``` + +For more examples see the [demo page](./index.html). + ### Options reference -| Property | Default Value | Values | Type | Description | -| -----------------| ------------- | ------ | ----------------- | ----------------------------- | -| latitude | 0.0 | | Float | latitude of the map | -| longitude | 0.0 | | Float | longitude of the map | -| maxClusterRadius | 80 | | Integer | | -| zoom | auto | 1 - 19 | Integer | zoom level of he map | -| zoomControl | true | | Boolean | are the zoomcontols avaible | -| fullscreenControl| true | | Boolean | is the fullscreencontrol avaible | -| addMarker | false | | Boolean | enables adding markers | -| boundsPadding | 20 | | Integer | | -| autolocate | false | | Boolean | locates your location | -| geosearch | false | | Boolean | search a location via osm,esri, google, bing| -| geosearchProvider| openstreetmap | esri, google, bing | String | select your favorit locator| -| locatecontrol | false | | Boolean | | -| minimap | false | | Boolean | enables the minimap | -| defaullt_map_layer | { id: "OpenStreetMap.Mapnik", options: {} } | |Dict | | -| map_layers | [] | | List of Dicts | | -| image_path | 'node_modules/leaflet.awesome-markers/dist/images' | | String | | -| geojson_ajaxurl | | | String | | \ No newline at end of file +Some options resemble the options from leaflet. +You might also check [their documentation](https://leafletjs.com/reference.html). + + +| Property | Default Value | Values | Type | Description | +| ------------------ | ------------- | ------ | ----------------- | ------------------------------------------------ | +| latitude | 0.0 | | Float | Latitude of the map. | +| longitude | 0.0 | | Float | Longitude of the map. | +| boundsPadding | 20 | | Integer | Padding for map boundaries. | +| maxClusterRadius | 80 | | Integer | Set the marker cluster radius. | +| zoom | auto | 1 - 19 | Integer | Zoom level of he map. | +| zoomControl | true | | Boolean | Show zoom control buttons. | +| fullscreenControl | true | | Boolean | Show the fullscreen control button. | +| addMarker | false | | Boolean | Enable feature to add markers. | +| locatecontrol | false | | Boolean | Adds a button to show your position on the map. | +| autolocate | false | | Boolean | Automatically set map to your location. | +| geosearch | false | | Boolean | Search a location via osm, esri, google or bing. | +| geosearch_provider | openstreetmap | openstreetmap, esri, google, bing | String | Service for location searches. | +| minimap | false | | Boolean | Enables the minimap overview map. | +| defaullt_map_layer | { id: "OpenStreetMap.Mapnik", options: {} } | | Dict | Define the default map layer. | +| map_layers | [] | | List of Dicts | Define the available map layers (More info in source code). | +| image_path | 'node_modules/leaflet.awesome-markers/dist/images' | | String | Import path to icons. | +| geojson_ajaxurl | | | String | Define a AJAX endpoint for geojson data to load (More info in source code. | diff --git a/src/index.html b/src/index.html index c206650..8be9e54 100644 --- a/src/index.html +++ b/src/index.html @@ -3,24 +3,28 @@ leaflet demo - + +

pat-leaflet demo - minimal

-
+
+
+

pat-leaflet demo - full

-
pat-leaflet demo - full } } ]}'>
- - + + + From 57d124212504aee9e77399aaf361dcd0d0d514f7 Mon Sep 17 00:00:00 2001 From: Martin Peeters Date: Thu, 16 Feb 2023 09:35:37 +0100 Subject: [PATCH 3/3] feat: Add option "useCluster" for switching marker cluster on or off. --- src/documentation.md | 1 + src/index.html | 3 ++- src/leaflet.js | 14 +++++++++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/documentation.md b/src/documentation.md index 1cc78e2..3c9ed47 100644 --- a/src/documentation.md +++ b/src/documentation.md @@ -35,6 +35,7 @@ You might also check [their documentation](https://leafletjs.com/reference.html) | latitude | 0.0 | | Float | Latitude of the map. | | longitude | 0.0 | | Float | Longitude of the map. | | boundsPadding | 20 | | Integer | Padding for map boundaries. | +| useCluster | true | | Boolean | Enable/Disable the marker cluster feature. | | maxClusterRadius | 80 | | Integer | Set the marker cluster radius. | | zoom | auto | 1 - 19 | Integer | Zoom level of he map. | | zoomControl | true | | Boolean | Show zoom control buttons. | diff --git a/src/index.html b/src/index.html index 8be9e54..7e8e20e 100644 --- a/src/index.html +++ b/src/index.html @@ -32,7 +32,8 @@

pat-leaflet demo - full

"geosearch": true, "geosearch_provider": "nominatim", "addmarker": true, -"maxClusterRadius": 80 +"maxClusterRadius": 80, +"useCluster": true }' data-geojson='{ "type": "FeatureCollection", diff --git a/src/leaflet.js b/src/leaflet.js index 00faeb9..24e4061 100644 --- a/src/leaflet.js +++ b/src/leaflet.js @@ -16,6 +16,7 @@ parser.addArgument("longitude", "0.0"); parser.addArgument("zoom", "auto"); parser.addArgument("maxClusterRadius", "80"); +parser.addArgument("useCluster", true); parser.addArgument("boundsPadding", "20"); @@ -82,9 +83,13 @@ class Pattern extends BasePattern { sleepOpacity: 1, })); - const marker_cluster = (this.marker_cluster = new LMarkerClusterGroup({ - maxClusterRadius: this.options.maxClusterRadius, - })); + if (options.useCluster == true) { + this.marker_cluster = new LMarkerClusterGroup({ + maxClusterRadius: this.options.maxClusterRadius, + }); + } else { + this.marker_cluster = new this.L.featureGroup(); + } // hand over some map events to the element map.on("moveend zoomend", (e) => { @@ -196,7 +201,7 @@ class Pattern extends BasePattern { { properties: { editable: true, popup: e.location.label } }, e.marker ); - marker_cluster.addLayer(e.marker); + this.marker_cluster.addLayer(e.marker); } // fit to window map.fitBounds([latlng], fitBoundsOptions); @@ -320,7 +325,6 @@ class Pattern extends BasePattern { bounds = this.marker_cluster.getBounds(); map.fitBounds(bounds, this.fitBoundsOptions); } - } bind_popup(feature, marker) {