From e6b1acbf2d7bdf1ea723b673f1832634110ea0de Mon Sep 17 00:00:00 2001 From: JFH <20402845+jfhenon@users.noreply.github.com> Date: Tue, 21 Sep 2021 20:26:45 +0200 Subject: [PATCH] fix context panel --- src/editor/Editor.js | 2 +- src/editor/EditorStartup.js | 24 +++++++++++------------- src/editor/svgedit.css | 8 ++------ 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/editor/Editor.js b/src/editor/Editor.js index 249a0404..94e69492 100644 --- a/src/editor/Editor.js +++ b/src/editor/Editor.js @@ -652,7 +652,7 @@ class Editor extends EditorStartup { if (context) { let str = ''; linkStr = '' + this.svgCanvas.getCurrentDrawing().getCurrentLayerName() + ''; - const parentsUntil = getParentsUntil(context, '#svgcontent > g'); + const parentsUntil = getParentsUntil(context, '#svgcontent'); parentsUntil.forEach(function (parent) { if (parent.id) { str += ' > ' + parent.id; diff --git a/src/editor/EditorStartup.js b/src/editor/EditorStartup.js index 39cb8121..88052425 100644 --- a/src/editor/EditorStartup.js +++ b/src/editor/EditorStartup.js @@ -140,20 +140,18 @@ class EditorStartup { this.selectedElement = null; this.multiselected = false; - const aLinks = $id('cur_context_panel').querySelectorAll('a'); + const aLink = $id('cur_context_panel'); - for (const aLink of aLinks) { - aLink.addEventListener('click', (evt) => { - const link = evt.currentTarget; - if (link.hasAttribute('data-root')) { - this.svgCanvas.leaveContext(); - } else { - this.svgCanvas.setContext(link.textContent); - } - this.svgCanvas.clearSelection(); - return false; - }); - } + aLink.addEventListener('click', (evt) => { + const link = evt.target; + if (link.hasAttribute('data-root')) { + this.svgCanvas.leaveContext(); + } else { + this.svgCanvas.setContext(link.textContent); + } + this.svgCanvas.clearSelection(); + return false; + }); // bind the selected event to our function that handles updates to the UI this.svgCanvas.bind('selected', this.selectedChanged.bind(this)); diff --git a/src/editor/svgedit.css b/src/editor/svgedit.css index 18b3a95d..11d64b9c 100644 --- a/src/editor/svgedit.css +++ b/src/editor/svgedit.css @@ -1,6 +1,6 @@ :root { --main-bg-color: #72797A; - --text-color: #ffffff; + --text-color: #000000; --border-color: #808080; --canvas-bg-color: #B2B2B2; --link-color: #19c; @@ -384,17 +384,13 @@ hr { } #cur_context_panel { - position: absolute; - top: 57px; - left: 56px; + grid-area: rulerX; line-height: 22px; overflow: auto; padding-left: 5px; font-size: 12px; background: rgba(0, 0, 0, 0.8); color: #ccc; - padding: 0 10px; - border-radius: 0 0 3px 0; } #cur_context_panel a {