Skip to content

Commit

Permalink
fix: onMove handler when closest is null
Browse files Browse the repository at this point in the history
  • Loading branch information
danyhoron committed Oct 26, 2023
1 parent 9c695b4 commit a8a05c6
Show file tree
Hide file tree
Showing 4 changed files with 1,256 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ L.Snap.Gridlines draws a grid on the map, and enables L.Snap to snap to its line
CHANGELOG
---------

### 0.0.6
* Fix onMove handler when closest is null

### 0.0.4

* Fix to use leaflet-draw ^0.3.0
Expand Down
2 changes: 1 addition & 1 deletion leaflet.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ L.Handler.MarkerSnap = L.Handler.extend({
_snapMarker: function(e) {
var closest = L.Snap.snapMarker(e, this._guides, this._map, this.options, this._buffer);

if (e.originalEvent && e.originalEvent.clientX && closest.layer && closest.latlng) {
if (e.originalEvent && e.originalEvent.clientX && closest && closest.layer && closest.latlng) {
var snapTouchPoint = this._map.project(closest.latlng, this._map.getZoom());
e.originalEvent.clientX = snapTouchPoint.x;
e.originalEvent.clientY = snapTouchPoint.y;
Expand Down
Loading

0 comments on commit a8a05c6

Please sign in to comment.