Skip to content

Commit a192e2a

Browse files
committed
Fix - protect marker drag handler
In case when cleanup done in-between
1 parent 2be068a commit a192e2a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/draw/more.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,13 @@ function drawMarker() {
315315
this.moveDrag = function(dx, dy) {
316316
this.dx += dx;
317317
this.dy += dy;
318-
makeTranslate(this.draw_g.select('path'), this.dx, this.dy);
318+
if (this.draw_g)
319+
makeTranslate(this.draw_g.select('path'), this.dx, this.dy);
319320
};
320321

321322
this.moveEnd = function(not_changed) {
322-
if (not_changed) return;
323+
if (not_changed || !this.draw_g)
324+
return;
323325
const mrk = this.getObject();
324326
let fx = this.svgToAxis('x', this.axisToSvg('x', mrk.fX, this.isndc) + this.dx, this.isndc),
325327
fy = this.svgToAxis('y', this.axisToSvg('y', mrk.fY, this.isndc) + this.dy, this.isndc);

0 commit comments

Comments
 (0)