Skip to content

Commit c3fa040

Browse files
st1gokperliedman
authored andcommitted
Update control.js (#554)
* Update control.js fix out of bounds error when a click occurs at the end of the line * Fix code style * Update control.js
1 parent 8b7a084 commit c3fa040

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/control.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,9 @@
220220

221221
_hookEvents: function(l) {
222222
l.on('linetouched', function(e) {
223-
this._plan.dragNewWaypoint(e);
223+
if (e.afterIndex < this.getWaypoints().length - 1) {
224+
this._plan.dragNewWaypoint(e);
225+
}
224226
}, this);
225227
},
226228

0 commit comments

Comments
 (0)