From 75c6e73312fa84f5b0ae2eb12e7fc9179412d040 Mon Sep 17 00:00:00 2001 From: Robin Nicole Date: Wed, 13 Aug 2025 15:29:13 +0200 Subject: [PATCH 1/6] fix: could draw relation on top of reduced notes --- src/js/utils/misc.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/js/utils/misc.js b/src/js/utils/misc.js index fb4c1f2e..a6b8573a 100644 --- a/src/js/utils/misc.js +++ b/src/js/utils/misc.js @@ -373,6 +373,8 @@ export function id_in_svg(draw_context, id) { // that's how it is), then dc.id_prefix to calculate the final id var layer_id = id_in_layer(draw_context.layer, id) var svg_note = document.getElementById(layer_id) + if (svg_note.classList.contains('hidden-reduced')) + return null if (draw_context.svg_elem.contains(svg_note)) return layer_id if (layer_id) From 0a5a93b1417de6deb4017f41d58befc60ae5936c Mon Sep 17 00:00:00 2001 From: Robin Nicole Date: Wed, 13 Aug 2025 15:35:38 +0200 Subject: [PATCH 2/6] fix: could draw metarelations on top of reduced relations --- src/js/action/draw.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/js/action/draw.js b/src/js/action/draw.js index 38dc6bfa..a868ad19 100644 --- a/src/js/action/draw.js +++ b/src/js/action/draw.js @@ -206,9 +206,10 @@ export function draw_metarelation(draw_context, mei_graph, g_elem) { var type = relation_type(g_elem) // Get the targets - we don't differentiate primaries and secondaries in // this drawing style. - var targets = relation_allnodes(mei_graph, g_elem).map( - (e) => document.getElementById(draw_context.id_prefix + get_id(e))) - // TODO should be possible to draw partial metarelations + var targets = relation_allnodes(mei_graph, g_elem).map((e) => { + let he = document.getElementById(draw_context.id_prefix + get_id(e)) + return he.classList.contains('hidden-reduced') ? null : he + }) if (targets.indexOf(null) != -1) { console.log('Missing relation, not drawing metarelation') return [] From a580a985417f423b5f758a08ba444bb76f910c59 Mon Sep 17 00:00:00 2001 From: Robin Nicole Date: Wed, 13 Aug 2025 15:49:20 +0200 Subject: [PATCH 3/6] fix: console error when creating metarelation out of reduced relations --- src/js/action/draw.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/js/action/draw.js b/src/js/action/draw.js index a868ad19..afd5aec4 100644 --- a/src/js/action/draw.js +++ b/src/js/action/draw.js @@ -208,6 +208,7 @@ export function draw_metarelation(draw_context, mei_graph, g_elem) { // this drawing style. var targets = relation_allnodes(mei_graph, g_elem).map((e) => { let he = document.getElementById(draw_context.id_prefix + get_id(e)) + if (!he) return return he.classList.contains('hidden-reduced') ? null : he }) if (targets.indexOf(null) != -1) { From a4f9eabb7a3934ecca7c5ca8333c66d0fc3834ae Mon Sep 17 00:00:00 2001 From: Robin Nicole Date: Wed, 13 Aug 2025 16:35:00 +0200 Subject: [PATCH 4/6] fix: could not create new layer on some files --- src/js/utils/misc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/utils/misc.js b/src/js/utils/misc.js index a6b8573a..5406868d 100644 --- a/src/js/utils/misc.js +++ b/src/js/utils/misc.js @@ -373,7 +373,7 @@ export function id_in_svg(draw_context, id) { // that's how it is), then dc.id_prefix to calculate the final id var layer_id = id_in_layer(draw_context.layer, id) var svg_note = document.getElementById(layer_id) - if (svg_note.classList.contains('hidden-reduced')) + if (svg_note && svg_note.classList.contains('hidden-reduced')) return null if (draw_context.svg_elem.contains(svg_note)) return layer_id From 97ce21be9a4a77e53800e20bda815d5633843982 Mon Sep 17 00:00:00 2001 From: Robin Nicole Date: Thu, 14 Aug 2025 10:10:48 +0200 Subject: [PATCH 5/6] fix: console error when clicking on some relations --- src/js/modules/Score/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/js/modules/Score/index.js b/src/js/modules/Score/index.js index e2f9ab25..f1ad00c3 100644 --- a/src/js/modules/Score/index.js +++ b/src/js/modules/Score/index.js @@ -36,7 +36,10 @@ class Score { // Cached members. get flatSelection() { - return this.#cache.remember('flatSelection', () => Object.values(this.selection).flat()) + return this.#cache.remember('flatSelection', + () => this.selection + ? Object.values(this.selection).flat() + : null) } get hasSelection() { @@ -46,7 +49,9 @@ class Score { get selectionType() { return this.#cache.remember('selectionType', () => { return SELECTABLE_TYPES.find(type => { - return this.flatSelection[0]?.classList.contains(type) + return this.flatSelection + ? this.flatSelection[0]?.classList.contains(type) + : null }) ?? null }) } From 38a2a2fb4bd69fbe0be71bf6fe48da72ae475931 Mon Sep 17 00:00:00 2001 From: Robin Nicole Date: Thu, 14 Aug 2025 12:33:11 +0200 Subject: [PATCH 6/6] fix: console error when creating metarelation on reduced relation --- src/js/action/draw.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/js/action/draw.js b/src/js/action/draw.js index afd5aec4..1295b130 100644 --- a/src/js/action/draw.js +++ b/src/js/action/draw.js @@ -211,12 +211,14 @@ export function draw_metarelation(draw_context, mei_graph, g_elem) { if (!he) return return he.classList.contains('hidden-reduced') ? null : he }) - if (targets.indexOf(null) != -1) { + if (!targets[0]) { console.log('Missing relation, not drawing metarelation') return [] } - const isDownward = targets.every(target => target.getAttribute('is-downward') === 'true') + const isDownward = targets.every( + target => target.getAttribute('is-downward') === 'true' + ) // Where are our targets var coords = targets.map(target => {