dependabot[bot]
2024-06-04 09038f160444a9dee2004a3fe6fc22d30114aefd
quartz/components/scripts/graph.inline.ts
@@ -223,6 +223,18 @@
          .transition()
          .duration(200)
          .style("opacity", 0.2)
        d3.selectAll<HTMLElement, NodeData>(".node")
          .filter((d) => !connectedNodes.includes(d.id))
          .nodes()
          .map((it) => d3.select(it.parentNode as HTMLElement).select("text"))
          .forEach((it) => {
            let opacity = parseFloat(it.style("opacity"))
            it.transition()
              .duration(200)
              .attr("opacityOld", opacity)
              .style("opacity", Math.min(opacity, 0.2))
          })
      }
      // highlight links
@@ -245,6 +257,12 @@
      if (focusOnHover) {
        d3.selectAll<HTMLElement, NodeData>(".link").transition().duration(200).style("opacity", 1)
        d3.selectAll<HTMLElement, NodeData>(".node").transition().duration(200).style("opacity", 1)
        d3.selectAll<HTMLElement, NodeData>(".node")
          .filter((d) => !connectedNodes.includes(d.id))
          .nodes()
          .map((it) => d3.select(it.parentNode as HTMLElement).select("text"))
          .forEach((it) => it.transition().duration(200).style("opacity", it.attr("opacityOld")))
      }
      const currentId = d.id
      const linkNodes = d3
@@ -264,6 +282,13 @@
    // @ts-ignore
    .call(drag(simulation))
  // make tags hollow circles
  node
    .filter((d) => d.id.startsWith("tags/"))
    .attr("stroke", color)
    .attr("stroke-width", 2)
    .attr("fill", "var(--light)")
  // draw labels
  const labels = graphNode
    .append("text")