Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Leaflet v1.8.0 #1140

Merged
merged 10 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,12 @@ See the available options in the table below.
| requireSnapToFinish | `false` | Require the last point of a shape to be snapped. |
| tooltips | `true` | Show helpful tooltips for your user. |
| allowSelfIntersection | `true` | Allow self intersections. |
| templineStyle | `{ color: 'red' },` | [Leaflet path options](https://leafletjs.com/reference-1.7.1.html#path) for the lines between drawn vertices/markers. |
| hintlineStyle | `{ color: 'red', dashArray: [5, 5] }` | [Leaflet path options](https://leafletjs.com/reference-1.7.1.html#path) for the helper line between last drawn vertex and the cursor. |
| pathOptions | `null` | [Leaflet path options](https://leafletjs.com/reference-1.7.1.html#path) for the drawn layer (Only for L.Path layers). |
| markerStyle | `{ draggable: true }` | [Leaflet marker options](https://leafletjs.com/reference-1.7.1.html#marker-icon) (only for drawing markers). |
| templineStyle | `{ color: 'red' },` | [Leaflet path options](https://leafletjs.com/reference.html#path) for the lines between drawn vertices/markers. |
| hintlineStyle | `{ color: 'red', dashArray: [5, 5] }` | [Leaflet path options](https://leafletjs.com/reference.html#path) for the helper line between last drawn vertex and the cursor. |
| pathOptions | `null` | [Leaflet path options](https://leafletjs.com/reference.html#path) for the drawn layer (Only for L.Path layers). |
| markerStyle | `{ draggable: true }` | [Leaflet marker options](https://leafletjs.com/reference.html#marker-icon) (only for drawing markers). |
| cursorMarker | `true` | Show a marker at the cursor. |
| finishOn | `null` | Leaflet layer event to finish the drawn shape, like `'dblclick'`. [Here's a list](http://leafletjs.com/reference-1.7.1.html#interactive-layer-click). `snap` is also an option for Line, Polygon and Rectangle. |
| finishOn | `null` | Leaflet layer event to finish the drawn shape, like `'dblclick'`. [Here's a list](http://leafletjs.com/reference.html#interactive-layer-click). `snap` is also an option for Line, Polygon and Rectangle. |
| hideMiddleMarkers | `false` | Hide the middle Markers in Edit Mode from Polyline and Polygon. |
| minRadiusCircle | `null` | Set the min radius of a `Circle`. |
| maxRadiusCircle | `null` | Set the max radius of a `Circle`. |
Expand Down Expand Up @@ -402,9 +402,9 @@ See the available options in the table below.
| allowCutting | `true` | Layer can be prevented from cutting. |
| allowRotation | `true` | Layer can be prevented from rotation. |
| draggable | `true` | Dragging can be disabled for the layer. |
| addVertexOn | `click` | Leaflet layer event to add a vertex to a Line or Polygon, like `'dblclick'`. [Here's a list](http://leafletjs.com/reference-1.7.1.html#interactive-layer-click). |
| addVertexOn | `click` | Leaflet layer event to add a vertex to a Line or Polygon, like `'dblclick'`. [Here's a list](http://leafletjs.com/reference.html#interactive-layer-click). |
| addVertexValidation | `undefined` | A function for validation if a vertex (of a Line / Polygon) is allowed to add. It passes a object with `[layer, marker, event}`. For example to check if the layer has a certain property or if the `Ctrl` key is pressed. |
| removeVertexOn | `contextmenu` | Leaflet layer event to remove a vertex from a Line or Polygon, like `'dblclick'`. [Here's a list](http://leafletjs.com/reference-1.7.1.html#interactive-layer-click). |
| removeVertexOn | `contextmenu` | Leaflet layer event to remove a vertex from a Line or Polygon, like `'dblclick'`. [Here's a list](http://leafletjs.com/reference.html#interactive-layer-click). |
| removeVertexValidation | `undefined` | A function for validation if a vertex (of a Line / Polygon) is allowed to remove. It passes a object with `[layer, marker, event}`. For example to check if the layer has a certain property or if the `Ctrl` key is pressed. |
| moveVertexValidation | `undefined` | A function for validation if a vertex / helper-marker is allowed to move / drag. It passes a object with `[layer, marker, event}`. For example to check if the layer has a certain property or if the `Ctrl` key is pressed. |
| limitMarkersToCount | `-1` | Shows only `n` markers closest to the cursor. Use `-1` for no limit. |
Expand Down Expand Up @@ -767,7 +767,7 @@ The following options are additionally to the [Draw](#draw-mode) and [Edit Mode]
| :------------ | :------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| snappingOrder | `Array` | Prioritize the order of snapping. Default: `['Marker','CircleMarker','Circle','Line','Polygon','Rectangle']`. |
| layerGroup | `map` | add the created layers to a layergroup instead to the map. |
| panes | `Object` | Defines in which [panes](https://leafletjs.com/reference-1.7.1.html#map-pane) the layers and helper vertices are created. Default: `{ vertexPane: 'markerPane', layerPane: 'overlayPane', markerPane: 'markerPane' }`. |
| panes | `Object` | Defines in which [panes](https://leafletjs.com/reference.html#map-pane) the layers and helper vertices are created. Default: `{ vertexPane: 'markerPane', layerPane: 'overlayPane', markerPane: 'markerPane' }`. |

Some details about a few more powerful options:

Expand Down Expand Up @@ -1088,15 +1088,15 @@ Using ES6 Module, a simple example would look something like this:
```js
import * as L from 'leaflet'

let map = L.Map()
let map = L.Map();

// map created and display on webpage
...

/* drawing script */
// at this point map.pm is undefined
if (!map.pm) {
await import(/* webpackChunkName: "leaflet-geoman" */ '@geoman-io/leaflet-geoman-free')
await import(/* webpackChunkName: "leaflet-geoman" */ '@geoman-io/leaflet-geoman-free');
L.PM.reInitLayer(map)
}
// map.pm is now defined and can be used to draw on map
Expand Down
2 changes: 2 additions & 0 deletions cypress/integration/circle.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ describe('Draw Circle', () => {
mapSimple = L.map('map', {
crs: L.CRS.Simple,
minZoom: -2,
doubleClickZoom: false, // Leaflet 1.8 DoubleTap fix
}).setView([0, 0], 0);
mapSimple.pm.addControls();
});
Expand Down Expand Up @@ -219,6 +220,7 @@ describe('Draw Circle', () => {
mapSimple = L.map('map', {
crs: L.CRS.Simple,
minZoom: -2,
doubleClickZoom: false, // Leaflet 1.8 DoubleTap fix
}).setView([0, 0], 0);
mapSimple.pm.addControls();
});
Expand Down
1 change: 1 addition & 0 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ beforeEach(() => {
// create the map
const map = L.map('map', {
preferCanvas: false,
doubleClickZoom: false, // Leaflet 1.8 DoubleTap fix
})
.setView([51.505, -0.09], 13)
.addLayer(tiles);
Expand Down
90 changes: 50 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"devDependencies": {
"@babel/core": "7.14.0",
"@babel/preset-env": "7.14.1",
"@types/leaflet": "^1.7.0",
"@types/leaflet": "^1.7.9",
"babel-loader": "8.2.2",
"copy-webpack-plugin": "8.1.1",
"css-loader": "5.2.4",
Expand All @@ -43,7 +43,7 @@
"eslint-plugin-cypress": "2.11.3",
"eslint-plugin-import": "2.22.1",
"file-loader": "6.2.0",
"leaflet": "1.7.1",
"leaflet": "1.8.0",
"mini-css-extract-plugin": "1.6.0",
"prettier": "2.2.1",
"prosthetic-hand": "1.3.1",
Expand Down
Loading