From 5c9cab1492308c2c20a5ea9f78a147337a01ed30 Mon Sep 17 00:00:00 2001 From: Maximilian Giller <m.giller@tu-bs.de> Date: Thu, 6 Jan 2022 11:51:53 +0100 Subject: [PATCH] Fixed context not working --- editor/js/tools/menus/collectmenu.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/editor/js/tools/menus/collectmenu.js b/editor/js/tools/menus/collectmenu.js index e002016..df6ddaf 100644 --- a/editor/js/tools/menus/collectmenu.js +++ b/editor/js/tools/menus/collectmenu.js @@ -1,7 +1,7 @@ import jQuery from "jquery"; import { Graph } from "../../graph"; import { CONTEXT } from "../../state"; -import { state } from "../editor"; +import { state } from "../../editor"; import ToolMenu from "./toolmenu"; export const COLLECTION_KEY = "collection"; @@ -68,18 +68,24 @@ export class CollectMenu extends ToolMenu { } // Disable previous context - if (this.context !== undefined) { - this.getDomToContext(this.context).addClass(HIDDEN_CLASS); + var dom = this.getDomToContext(this.context); + if (dom !== undefined) { + dom.addClass(HIDDEN_CLASS); } // Store and activate new context this.context = context; - if (this.context !== undefined) { - this.getDomToContext(this.context).removeClass(HIDDEN_CLASS); + dom = this.getDomToContext(this.context); + if (dom !== undefined) { + dom.removeClass(HIDDEN_CLASS); } } getDomToContext(context) { + if (context === undefined) { + return undefined; + } + if (context === CONTEXT.node) { return this.find(CONTEXT_NODE); } else { -- GitLab