diff --git a/frontend/src/components/GraphCanvas.svelte b/frontend/src/components/GraphCanvas.svelte index 391bf72..85532cb 100644 --- a/frontend/src/components/GraphCanvas.svelte +++ b/frontend/src/components/GraphCanvas.svelte @@ -236,12 +236,14 @@ function applyVolumeAtMouse(e: MouseEvent, nodeId: number) { const nd = graphNodes.find(n => n.id === nodeId); if (!nd || !svgEl) return; - const volX = nd.x + 8; - const volW = nd.width - 36; - const svgRect = svgEl.getBoundingClientRect(); - // Convert mouse X to SVG coordinate - const mouseSvgX = viewBox.x + (e.clientX - svgRect.left) * viewBox.w / svgRect.width; - const ratio = (mouseSvgX - volX) / volW; + + // Get the hitarea SVG element's screen rect directly + const hitarea = svgEl.querySelector(`.node-group[data-node-id="${nodeId}"] .vol-hitarea`); + if (!hitarea) return; + const rect = (hitarea as SVGElement).getBoundingClientRect(); + + // Ratio from left edge of hitarea + const ratio = (e.clientX - rect.left) / rect.width; const clamped = Math.max(0, Math.min(1, ratio)); setNodeVolume(nodeId, clamped); } @@ -656,7 +658,7 @@ - +