Skip to content

Commit

Permalink
Link name opacity change
Browse files Browse the repository at this point in the history
  • Loading branch information
natefrisch01 committed May 5, 2024
1 parent 7fecf1f commit e933691
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
13 changes: 9 additions & 4 deletions src/linkManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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
};
Expand All @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};
}

Expand Down

0 comments on commit e933691

Please sign in to comment.