From d57ae4642a2428ad229468bf91067e55b50bc9f5 Mon Sep 17 00:00:00 2001 From: Robin Nicole Date: Thu, 24 Jul 2025 15:50:17 +0200 Subject: [PATCH 1/3] fix: relation layer would not delete parent There are still inconsistencies, sometimes it deletes non-parent edges --- src/js/action/delete.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/js/action/delete.js b/src/js/action/delete.js index c2dc9ae8..eb6c5322 100644 --- a/src/js/action/delete.js +++ b/src/js/action/delete.js @@ -210,12 +210,17 @@ function find_all_parent_relations(elem, mei, draw_contexts, svg_hes, processedI let meta_relations = [] let meta_relation_arcs = [] - const elemId = elem.id || get_id(elem) + const elemId = elem.id + ? elem.id.slice(elem.id.search(/[^\d]/)) + : get_id(elem) // Find arcs that connect meta-relations to this relation // Only look for arcs where this element is the target (to) - parent->child const meta_arcs = Array.from(mei.getElementsByTagName('arc')).filter( - arc => arc.getAttribute('to') == '#' + elemId + arc => { + console.log(arc.getAttribute('to')) + return arc.getAttribute('to') == '#' + elemId + } ) // For each arc, find the meta-relation nodes that are parents of this element From 122eed0a76bd7dac1d98a8c1ead47b6eae98f145 Mon Sep 17 00:00:00 2001 From: Robin Nicole Date: Fri, 25 Jul 2025 09:42:23 +0200 Subject: [PATCH 2/3] chore: remove console log --- src/js/action/delete.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/js/action/delete.js b/src/js/action/delete.js index eb6c5322..3f6aa609 100644 --- a/src/js/action/delete.js +++ b/src/js/action/delete.js @@ -217,10 +217,7 @@ function find_all_parent_relations(elem, mei, draw_contexts, svg_hes, processedI // Find arcs that connect meta-relations to this relation // Only look for arcs where this element is the target (to) - parent->child const meta_arcs = Array.from(mei.getElementsByTagName('arc')).filter( - arc => { - console.log(arc.getAttribute('to')) - return arc.getAttribute('to') == '#' + elemId - } + arc => arc.getAttribute('to') == '#' + elemId ) // For each arc, find the meta-relation nodes that are parents of this element From b1ea24be3bd696baa422f6a46b716178d916430f Mon Sep 17 00:00:00 2001 From: Robin Nicole Date: Mon, 28 Jul 2025 10:22:10 +0200 Subject: [PATCH 3/3] fix: parent deletion would overdelete some edges I commented out code that seems overly complicated, or maybe obsolete --- src/js/action/delete.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/js/action/delete.js b/src/js/action/delete.js index 3f6aa609..21b0b138 100644 --- a/src/js/action/delete.js +++ b/src/js/action/delete.js @@ -63,6 +63,7 @@ function delete_relation(elem) { const sourceElement = get_by_id(mei, fromId) // If the source is a metarelation, add the target as a child ID + // TODO: Why? if (sourceElement && sourceElement.getAttribute('type') === 'metarelation') { childIds.add(toId) } @@ -86,14 +87,14 @@ function delete_relation(elem) { // After deletion, check if any children need their connection circles removed // Store the returned connection circle data for undo - if (childIds.size > 0) { - const connectionCircleData = updateConnectionCircles(Array.from(childIds)) - - // Add connection circle data to the action_removed array if any was removed - if (connectionCircleData.length > 0) { - action_removed.push(['connection_circle_data', connectionCircleData]) - } - } + // if (childIds.size > 0) { + // const connectionCircleData = updateConnectionCircles(Array.from(childIds)) + + // // Add connection circle data to the action_removed array if any was removed + // if (connectionCircleData.length > 0) { + // action_removed.push(['connection_circle_data', connectionCircleData]) + // } + // } // Adjust SVG dimensions after deletion draw_contexts.forEach(draw_context => {