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

Fix for resizeableCircle #1516 #1518

Merged
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
16 changes: 8 additions & 8 deletions cypress/integration/circle.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,10 @@ describe('Draw Circle', () => {
});
});

it('creates circles (non-resizableCircle)', () => {
it('creates circles (non-resizeableCircle)', () => {
cy.window().then(({ map }) => {
map.pm.setGlobalOptions({
resizableCircle: false,
resizeableCircle: false,
continueDrawing: true,
});
});
Expand All @@ -373,9 +373,9 @@ describe('Draw Circle', () => {
cy.hasCircleLayers(3);
});

it('disable dragging correctly (non-resizableCircle)', () => {
it('disable dragging correctly (non-resizeableCircle)', () => {
cy.window().then(({ map }) => {
map.pm.setGlobalOptions({ resizableCircle: false });
map.pm.setGlobalOptions({ resizeableCircle: false });
});

cy.toolbarButton('circle')
Expand All @@ -397,9 +397,9 @@ describe('Draw Circle', () => {
});
});

it('deletes no circles by right-click (non-resizableCircle)', () => {
it('deletes no circles by right-click (non-resizeableCircle)', () => {
cy.window().then(({ map }) => {
map.pm.setGlobalOptions({ resizableCircle: false });
map.pm.setGlobalOptions({ resizeableCircle: false });
});

cy.toolbarButton('circle')
Expand All @@ -421,9 +421,9 @@ describe('Draw Circle', () => {
cy.hasCircleLayers(1);
});

it('change color of circleMarker while drawing (non-resizableCircle)', () => {
it('change color of circleMarker while drawing (non-resizeableCircle)', () => {
cy.window().then(({ map }) => {
map.pm.setGlobalOptions({ resizableCircle: false });
map.pm.setGlobalOptions({ resizeableCircle: false });
});

cy.toolbarButton('circle')
Expand Down
2 changes: 1 addition & 1 deletion leaflet-geoman.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@ declare module 'leaflet' {
editable?: boolean;

/** Enables radius editing while drawing a Circle (default:true). */
resizableCircle?: boolean;
resizeableCircle?: boolean;

/** Enables radius editing while drawing a CircleMarker (default:false). */
resizeableCircleMarker?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/js/Draw/L.PM.Draw.Circle.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Draw.Circle = Draw.CircleMarker.extend({
this._BaseCircleClass = L.Circle;
this._minRadiusOption = 'minRadiusCircle';
this._maxRadiusOption = 'maxRadiusCircle';
this._editableOption = 'resizableCircle';
this._editableOption = 'resizeableCircle';
this._defaultRadius = 100;
},
_extendingEnable() {},
Expand Down
2 changes: 1 addition & 1 deletion src/js/Draw/L.PM.Draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Draw = L.Class.extend({
minRadiusCircleMarker: null,
maxRadiusCircleMarker: null,
resizeableCircleMarker: false,
resizableCircle: true,
resizeableCircle: true,
markerEditable: true,
continueDrawing: false,
snapSegment: true,
Expand Down
2 changes: 1 addition & 1 deletion src/js/Edit/L.PM.Edit.Circle.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Edit.Circle = Edit.CircleMarker.extend({

this._minRadiusOption = 'minRadiusCircle';
this._maxRadiusOption = 'maxRadiusCircle';
this._editableOption = 'resizableCircle';
this._editableOption = 'resizeableCircle';
// create polygon around the circle border
this._updateHiddenPolyCircle();
},
Expand Down
2 changes: 1 addition & 1 deletion src/js/Edit/L.PM.Edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Edit = L.Class.extend({
addVertexValidation: undefined,
moveVertexValidation: undefined,
resizeableCircleMarker: false,
resizableCircle: true,
resizeableCircle: true,
},
setOptions(options) {
L.Util.setOptions(this, options);
Expand Down
4 changes: 2 additions & 2 deletions src/js/L.PM.Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ const Map = L.Class.extend({
let reenableCircle = false;
if (
this.map.pm.Draw.Circle.enabled() &&
!!this.map.pm.Draw.Circle.options.resizableCircle !==
!!options.resizableCircle
!!this.map.pm.Draw.Circle.options.resizeableCircle !==
!!options.resizeableCircle
) {
this.map.pm.Draw.Circle.disable();
reenableCircle = true;
Expand Down
4 changes: 2 additions & 2 deletions src/js/Mixins/Dragging.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ const DragMixin = {
if (this._layer instanceof L.CircleMarker) {
let _editableOption = 'resizeableCircleMarker';
if (this._layer instanceof L.Circle) {
_editableOption = 'resizableCircle';
_editableOption = 'resizeableCircle';
}

if (this.options.snappable && !fromLayerSync && !layersToSyncFound) {
Expand Down Expand Up @@ -369,7 +369,7 @@ const DragMixin = {

if (
(this._layer instanceof L.Circle &&
this._layer.options.resizableCircle) ||
this._layer.options.resizeableCircle) ||
(this._layer instanceof L.CircleMarker &&
this._layer.options.resizeableCircleMarker)
) {
Expand Down