Skip to content

Commit

Permalink
Fixed Draw Circle for mobile. Closes #263 (patch)
Browse files Browse the repository at this point in the history
  • Loading branch information
codeofsumit committed Jul 5, 2018
1 parent 079bece commit 808eeb6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
22 changes: 22 additions & 0 deletions cypress/integration/circle.spec.js
@@ -0,0 +1,22 @@
describe('Draw Circle', () => {
const mapSelector = '#map';

it('draws a circle', () => {
cy.toolbarButton('circle')
.click()
.parent('a')
.should('have.class', 'active');

cy.get(mapSelector)
.click(200, 200)
.click(250, 250);

cy.toolbarButton('edit')
.click()
.parent('a')
.should('have.class', 'active');

cy.hasVertexMarkers(2);
cy.hasMiddleMarkers(0);
});
});
4 changes: 2 additions & 2 deletions src/js/Draw/L.PM.Draw.Circle.js
Expand Up @@ -172,10 +172,10 @@ Draw.Circle = Draw.extend({
});
}
},
_finishShape() {
_finishShape(e) {
// calc the radius
const center = this._centerMarker.getLatLng();
const cursor = this._hintMarker.getLatLng();
const cursor = e.latlng;
const radius = center.distanceTo(cursor);

// create the final circle layer
Expand Down

0 comments on commit 808eeb6

Please sign in to comment.