The Trans Directory
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(graph): obsidianLikeFocusOnHover (#1017)

* feat(graph): obsidianLikeFocusOnHover

* fix: prettier

* fix: remove option from config

* fix: for when opacityOld < 0.2

* fix: prettier

authored by

Dinu Blanovschi and committed by
GitHub
0b9f79e1 94fbf5b0

+18
+18
quartz/components/scripts/graph.inline.ts
··· 223 223 .transition() 224 224 .duration(200) 225 225 .style("opacity", 0.2) 226 + 227 + d3.selectAll<HTMLElement, NodeData>(".node") 228 + .filter((d) => !connectedNodes.includes(d.id)) 229 + .nodes() 230 + .map((it) => d3.select(it.parentNode as HTMLElement).select("text")) 231 + .forEach((it) => { 232 + let opacity = parseFloat(it.style("opacity")) 233 + it.transition() 234 + .duration(200) 235 + .attr("opacityOld", opacity) 236 + .style("opacity", Math.min(opacity, 0.2)) 237 + }) 226 238 } 227 239 228 240 // highlight links ··· 245 257 if (focusOnHover) { 246 258 d3.selectAll<HTMLElement, NodeData>(".link").transition().duration(200).style("opacity", 1) 247 259 d3.selectAll<HTMLElement, NodeData>(".node").transition().duration(200).style("opacity", 1) 260 + 261 + d3.selectAll<HTMLElement, NodeData>(".node") 262 + .filter((d) => !connectedNodes.includes(d.id)) 263 + .nodes() 264 + .map((it) => d3.select(it.parentNode as HTMLElement).select("text")) 265 + .forEach((it) => it.transition().duration(200).style("opacity", it.attr("opacityOld"))) 248 266 } 249 267 const currentId = d.id 250 268 const linkNodes = d3