fix(graph): update persistent for nodeGfx

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
Aaron Pham 2024-08-15 00:26:15 -04:00
parent e00c1ac491
commit d7b986f3f5
No known key found for this signature in database
GPG Key ID: 18974753009D2BFA

View File

@ -362,6 +362,7 @@ async function renderGraph(container: string, fullSlug: FullSlug) {
}) })
.circle(0, 0, nodeRadius(n)) .circle(0, 0, nodeRadius(n))
.on("pointerover", () => { .on("pointerover", () => {
if (!currentNodeGfx) {
tweens.get(nodeId)?.stop() tweens.get(nodeId)?.stop()
const tweenScale = { x: 1, y: 1 } const tweenScale = { x: 1, y: 1 }
const tween = new TWEEN.Tween(tweenScale) const tween = new TWEEN.Tween(tweenScale)
@ -375,6 +376,7 @@ async function renderGraph(container: string, fullSlug: FullSlug) {
.start() .start()
tweens.set(nodeId, tween) tweens.set(nodeId, tween)
renderCurrentNode({ nodeId, focusOnHover }) renderCurrentNode({ nodeId, focusOnHover })
}
}) })
.on("pointerdown", (e) => { .on("pointerdown", (e) => {
currentNodeGfx = e.target as PIXI.Graphics currentNodeGfx = e.target as PIXI.Graphics
@ -386,6 +388,7 @@ async function renderGraph(container: string, fullSlug: FullSlug) {
currentNodeGfx = undefined currentNodeGfx = undefined
}) })
.on("pointerleave", () => { .on("pointerleave", () => {
if (!currentNodeGfx) {
tweens.get(nodeId)?.stop() tweens.get(nodeId)?.stop()
const tweenScale = { const tweenScale = {
x: gfx.scale.x, x: gfx.scale.x,
@ -402,6 +405,7 @@ async function renderGraph(container: string, fullSlug: FullSlug) {
.start() .start()
tweens.set(nodeId, tween) tweens.set(nodeId, tween)
renderCurrentNode({ nodeId: null, focusOnHover }) renderCurrentNode({ nodeId: null, focusOnHover })
}
}) })
n.gfx = gfx n.gfx = gfx