diff --git a/src/lib/navigator/EventNetwork/Legend.svelte b/src/lib/navigator/EventNetwork/Legend.svelte
index 3b189e1..12a68da 100644
--- a/src/lib/navigator/EventNetwork/Legend.svelte
+++ b/src/lib/navigator/EventNetwork/Legend.svelte
@@ -301,7 +301,7 @@
{#if autoDisabledTags}
- Note: All {tagAnchors.length} tags were auto-disabled to prevent graph overload. Click individual tags below to enable them.
+ Note: Some tags were auto-disabled to prevent graph overload. Click individual tags below to enable/disable them.
{/if}
@@ -334,11 +334,12 @@
{#each sortedAnchors as tag}
- {@const isDisabled = disabledTags.has(tag.value)}
+ {@const tagId = `${tag.type}-${tag.label}`}
+ {@const isDisabled = disabledTags.has(tagId)}
onTagToggle(tag.value)}
- onkeydown={(e) => e.key === 'Enter' || e.key === ' ' ? onTagToggle(tag.value) : null}
+ onclick={() => onTagToggle(tagId)}
+ onkeydown={(e) => e.key === 'Enter' || e.key === ' ' ? onTagToggle(tagId) : null}
disabled={false}
title={isDisabled ? `Click to show ${tag.label}` : `Click to hide ${tag.label}`}
aria-pressed={!isDisabled}
diff --git a/src/lib/navigator/EventNetwork/index.svelte b/src/lib/navigator/EventNetwork/index.svelte
index 5e6190e..98ad74a 100644
--- a/src/lib/navigator/EventNetwork/index.svelte
+++ b/src/lib/navigator/EventNetwork/index.svelte
@@ -156,7 +156,7 @@
let autoDisabledTags = $state(false);
// Maximum number of tag anchors before auto-disabling
- const MAX_TAG_ANCHORS = 20;
+ const MAX_TAG_ANCHORS = 50;
// Person nodes state
let showPersonNodes = $state(false);
@@ -1108,11 +1108,14 @@
if (tagAnchorInfo.length > MAX_TAG_ANCHORS && !autoDisabledTags) {
// Defer the state update to break the sync cycle
autoDisableTimer = setTimeout(() => {
- debug(`Auto-disabling tags: ${tagAnchorInfo.length} exceeds maximum of ${MAX_TAG_ANCHORS}`);
+ debug(`Auto-disabling excess tags: ${tagAnchorInfo.length} exceeds maximum of ${MAX_TAG_ANCHORS}`);
+
+ // Sort tags by count (most connected first) and disable the excess ones
+ const sortedTags = [...tagAnchorInfo].sort((a, b) => b.count - a.count);
+ const tagsToDisable = sortedTags.slice(MAX_TAG_ANCHORS);
- // Disable all tags
const newDisabledTags = new Set();
- tagAnchorInfo.forEach(anchor => {
+ tagsToDisable.forEach(anchor => {
const tagId = `${anchor.type}-${anchor.label}`;
newDisabledTags.add(tagId);
});
@@ -1121,13 +1124,15 @@
autoDisabledTags = true;
// Optional: Show a notification to the user
- console.info(`[EventNetwork] Auto-disabled ${tagAnchorInfo.length} tag anchors to prevent graph overload. Click individual tags in the legend to enable them.`);
+ console.info(`[EventNetwork] Auto-disabled ${tagsToDisable.length} tag anchors to prevent graph overload. Click individual tags in the legend to enable them.`);
}, 0);
}
// Reset auto-disabled flag if tag count goes back down
if (tagAnchorInfo.length <= MAX_TAG_ANCHORS && autoDisabledTags) {
autoDisableTimer = setTimeout(() => {
+ // Clear disabled tags when we're back under the limit
+ disabledTags.clear();
autoDisabledTags = false;
}, 0);
}