Skip to content

Commit

Permalink
Adapt to new version lib
Browse files Browse the repository at this point in the history
  • Loading branch information
kctekn committed Dec 6, 2024
1 parent 1310828 commit 89b4be5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"typescript": "4.7.4"
},
"dependencies": {
"3d-force-graph": "^1.70.12",
"3d-force-graph": "^1.74.1",
"three": "^0.169.0",
"three-spritetext": "^1.8.2"
}
Expand Down
9 changes: 5 additions & 4 deletions src/views/TagsRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { settingGroup } from "./settings"
import TagsRoutes, { defaltColorMap, DEFAULT_DISPLAY_SETTINGS, globalDirectory, globalProgramControl, TagRoutesSettings } from '../main';
import { Vector2, Vector3 } from 'three';
import SpriteText from 'three-spritetext';
import { NodeObject, LinkObject as LinkObjectTF, ThreeForceGraphGeneric } from 'three-forcegraph';

export const VIEW_TYPE_TAGS_ROUTES = "tags-routes";
interface GraphData {
Expand Down Expand Up @@ -1565,15 +1566,15 @@ export class TagRoutesView extends ItemView {

if (value) {
// DebugMsg(DebugLevel.WARN, "Go to freeze");
this.Graph.graphData().nodes.forEach(node => {
this.Graph.graphData().nodes.forEach((node:NodeObject) => {
node.fx = node.x;
node.fy = node.y;
node.fz = node.z;
});
this.Graph.enableNodeDrag(false)
} else {
// DebugMsg(DebugLevel.WARN, "Go to un-freeze");
this.Graph.graphData().nodes.forEach(node => {
this.Graph.graphData().nodes.forEach((node:NodeObject) => {
node.fx = undefined;
node.fy = undefined;
node.fz = undefined;
Expand Down Expand Up @@ -2463,15 +2464,15 @@ export class TagRoutesView extends ItemView {
hideToolbar.innerHTML = tooltipBar.hasClass('hidden') ? '>' : '<';
})

this.Graph = ForceGraph3D()
this.Graph = new ForceGraph3D(graphContainer)
// .width(container.clientWidth)
// .height(container.clientHeight)
.backgroundColor("#000003")
.d3Force('link', d3.forceLink().distance((link: any) => {
const distance = Math.max(link.source.connections, link.target.connections, link.source.instanceNum || 2, link.target.instanceNum || 2);
return distance < 10 ? 20 : distance * this.distanceFactor;
}))
(graphContainer)
// (graphContainer)
.nodeVisibility(this.getNodeVisible)
.linkVisibility(this.getLinkVisible)
.linkColor((link: any) => this.highlightLinks.has(link) ? this.plugin.settings.customSlot?.[0].colorMap["linkHighlightColor"].value||"#ffffff" :
Expand Down

0 comments on commit 89b4be5

Please sign in to comment.