From a55ecfe244db3715fef79071932514160de596f5 Mon Sep 17 00:00:00 2001 From: JFH <20402845+jfhenon@users.noreply.github.com> Date: Mon, 24 May 2021 10:07:01 +0200 Subject: [PATCH] fix issue on selection with no parent --- src/svgcanvas/selection.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/svgcanvas/selection.js b/src/svgcanvas/selection.js index e35c3a6a..abd584ee 100644 --- a/src/svgcanvas/selection.js +++ b/src/svgcanvas/selection.js @@ -162,21 +162,10 @@ export const getMouseTargetMethod = function (evt) { return selectionContext_.getCanvas().selectorManager.selectorParentGroup; } - while (!mouseTarget.parentNode.isSameNode(selectionContext_.getCurrentGroup() || currentLayer)) { + while (!mouseTarget.parentNode?.isSameNode(selectionContext_.getCurrentGroup() || currentLayer)) { mouseTarget = mouseTarget.parentNode; } - // - // // go up until we hit a child of a layer - // while (mouseTarget.parentNode.parentNode.tagName == 'g') { - // mouseTarget = mouseTarget.parentNode; - // } - // Webkit bubbles the mouse event all the way up to the div, so we - // set the mouseTarget to the svgroot like the other browsers - // if (mouseTarget.nodeName.toLowerCase() == 'div') { - // mouseTarget = svgroot; - // } - return mouseTarget; }; /**