Merge pull request #109 from Lattay/bugfix_zoom

Fix use of non standard path attribute in zoom wheel event
This commit is contained in:
Nicola 2022-12-23 22:07:31 +01:00 committed by GitHub
commit ee51874048
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -47,8 +47,9 @@ const ToolManager = (() => {
if (!EditorState.documentCreated || Dialogue.isOpen()) if (!EditorState.documentCreated || Dialogue.isOpen())
return; return;
const isHoveringMenuElement = !!mouseEvent.path.find(n=>n.id && n.id.includes("-menu")); // Hovering a menu element
if(isHoveringMenuElement)return; const path = mouseEvent.composedPath && mouseEvent.composedPath();
if (path && !!path.find(n=>n.id && n.id.includes("-menu"))) return;
let mousePos = Input.getCursorPosition(mouseEvent); let mousePos = Input.getCursorPosition(mouseEvent);
tools["zoom"].onMouseWheel(mousePos, mouseEvent.deltaY < 0 ? 'in' : 'out'); tools["zoom"].onMouseWheel(mousePos, mouseEvent.deltaY < 0 ? 'in' : 'out');
@ -164,4 +165,4 @@ const ToolManager = (() => {
return { return {
currentTool currentTool
} }
})(); })();