summaryrefslogtreecommitdiff
path: root/src/graph.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/graph.js')
-rw-r--r--src/graph.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/graph.js b/src/graph.js
index a210f23..3a0e8a1 100644
--- a/src/graph.js
+++ b/src/graph.js
@@ -3,7 +3,9 @@ import ForceGraph3D from "3d-force-graph";
import SpriteText from "three-spritetext";
import { union } from "./utils/set_utils.js";
-const IMG_SCALE = 20;
+const IMG_SCALE = 16;
+const MAIN_IMG_SCALE = 80;
+const OBJECT_SCALE = 10;
export default function buildGraph({ db, objects, handlers }) {
const linkable = {};
@@ -85,7 +87,7 @@ export default function buildGraph({ db, objects, handlers }) {
var center = new THREE.Vector3();
box.getCenter(center);
object.position.sub(center);
- object.scale.set(100, 100, 100);
+ object.scale.set(OBJECT_SCALE, OBJECT_SCALE, OBJECT_SCALE);
return object;
} else if (node.data.thumbnail?.uri) {
if (node.data.thumbnail.type === "video") {
@@ -103,7 +105,11 @@ export default function buildGraph({ db, objects, handlers }) {
const aspect = node.data.thumbnail.width / node.data.thumbnail.height;
material = new THREE.SpriteMaterial({ map: texture });
sprite = new THREE.Sprite(material);
- sprite.scale.set(IMG_SCALE, IMG_SCALE / aspect);
+ if (node.id === 0) {
+ sprite.scale.set(MAIN_IMG_SCALE, MAIN_IMG_SCALE / aspect);
+ } else {
+ sprite.scale.set(IMG_SCALE, IMG_SCALE / aspect);
+ }
return sprite;
} else {
sprite = new SpriteText(
@@ -117,6 +123,12 @@ export default function buildGraph({ db, objects, handlers }) {
})
.onNodeClick(handlers.click);
+ // TrackballControls
+ graph.controls().addEventListener("change", () => {
+ const position = graph.cameraPosition();
+ // console.log(position);
+ });
+
const initialZoom = () => {
const distance = 20000;
let angle = 0;