Skip to content

Commit

Permalink
Version 2.18.1
Browse files Browse the repository at this point in the history
Version 2.18.1
  • Loading branch information
Falke-Design authored Dec 29, 2024
2 parents 14a7dd7 + d72838e commit 0f287ad
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
23 changes: 23 additions & 0 deletions cypress/e2e/circle.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,4 +526,27 @@ describe('Draw Circle', () => {
expect(layer.getRadius()).to.eq(1328.278061564339);
});
});

it('checks if radius is changed when outer marker is snapped', () => {
cy.toolbarButton('rectangle').click();
cy.get(mapSelector).click(100, 100).click(400, 350);

cy.toolbarButton('circle').click();
cy.get(mapSelector).click(300, 200).click(400, 200);

cy.toolbarButton('edit').click();

// move marker
cy.get(mapSelector)
.trigger('mousedown', 400, 200, { which: 1 })
.trigger('mousemove', 390, 230, { which: 1 })
.trigger('mouseup', 390, 230, { which: 1 });

cy.window().then(({ map }) => {
const layer = map.pm.getGeomanLayers()[1];
expect(layer.getLatLng().lat).to.eq(51.51034504891232);
expect(layer.getLatLng().lng).to.eq(-0.12428283691406251);
expect(layer.getRadius()).to.eq(1240.3294565841613);
});
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@geoman-io/leaflet-geoman-free",
"version": "2.18.0",
"version": "2.18.1",
"description": "A Leaflet Plugin For Editing Geometry Layers in Leaflet 1.0",
"keywords": [
"leaflet",
Expand Down
3 changes: 3 additions & 0 deletions src/js/Edit/L.PM.Edit.CircleMarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ Edit.CircleMarker = Edit.extend({
this._initSnappableMarkers();
// update marker latlng when snapped latlng radius is out of min/max
this._outerMarker.on('drag', this._handleOuterMarkerSnapping, this);
// sync the hintline with hint marker
this._outerMarker.on('move', this._syncHintLine, this);
this._outerMarker.on('move', this._syncCircleRadius, this);
} else {
this._disableSnapping();
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/Toolbar/L.Controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const PMButton = L.Control.extend({
} else if (_action.text) {
action = _action;
} else {
return;
return action;
}
const actionNode = L.DomUtil.create(
'a',
Expand Down

0 comments on commit 0f287ad

Please sign in to comment.