From e933691fb92eb5785c263a1461847bc8283afeef Mon Sep 17 00:00:00 2001 From: Kidan Nelson <44580969+natefrisch01@users.noreply.github.com> Date: Sun, 5 May 2024 13:27:17 -0400 Subject: [PATCH] Link name opacity change --- manifest.json | 2 +- package-lock.json | 2 +- package.json | 2 +- src/linkManager.ts | 13 +++++++++---- src/types.ts | 6 ++++++ 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/manifest.json b/manifest.json index 0a9339f..1ee951c 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "graph-link-types", "name": "Graph Link Types", - "version": "0.3.2", + "version": "0.3.3", "minAppVersion": "1.5.0", "description": "Link types for graph view.", "author": "natefrisch01", diff --git a/package-lock.json b/package-lock.json index 8b0632a..2b64c5e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "graph-link-types", - "version": "0.3.2", + "version": "0.3.3", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package.json b/package.json index 848144b..42297a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "graph-link-types", - "version": "0.3.2", + "version": "0.3.3", "description": "Link types for Obsidian graph view.", "main": "main.js", "scripts": { diff --git a/src/linkManager.ts b/src/linkManager.ts index fa9ac1e..6c752e3 100644 --- a/src/linkManager.ts +++ b/src/linkManager.ts @@ -116,6 +116,7 @@ export class LinkManager { pixiText: this.initializeLinkText(renderer, obLink, pairStatus), pixiGraphics: tagColors ? this.initializeLinkGraphics(renderer, obLink, tagLegend) : null, }; + console.log(obLink); this.linksMap.set(key, newLink); @@ -200,10 +201,10 @@ export class LinkManager { return; } const linkKey = this.generateKey(link.source.id, link.target.id); - const obsLink = this.linksMap.get(linkKey); + const gltLink = this.linksMap.get(linkKey); let text; - if (obsLink) { - text = obsLink.pixiText; + if (gltLink) { + text = gltLink.pixiText; } else { return }; @@ -220,7 +221,11 @@ export class LinkManager { text.scale.set(1 / (3 * renderer.nodeScale)); text.style.fill = this.textColor; if (tagNames) { - text.alpha = 0.9; + if (!link.source || !link.target || !link.source.text || !link.target.text || !link.target.text.alpha || !link.source.text.alpha) { + text.alpha = 0.9; + } else { + text.alpha = Math.max(link.source.text.alpha, link.target.text.alpha); + } } else { text.alpha = 0.0; } diff --git a/src/types.ts b/src/types.ts index f8dd6ed..fcc83da 100644 --- a/src/types.ts +++ b/src/types.ts @@ -22,12 +22,18 @@ export interface ObsidianLink { x: number; y: number; weight: number; + text: { + alpha: number; + } }; target: { id: string; x: number; y: number; weight: number; + text: { + alpha: number; + } }; }