File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
quartz/components/scripts Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -223,6 +223,18 @@ async function renderGraph(container: string, fullSlug: FullSlug) {
223223 . transition ( )
224224 . duration ( 200 )
225225 . 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+ } )
226238 }
227239
228240 // highlight links
@@ -245,6 +257,12 @@ async function renderGraph(container: string, fullSlug: FullSlug) {
245257 if ( focusOnHover ) {
246258 d3 . selectAll < HTMLElement , NodeData > ( ".link" ) . transition ( ) . duration ( 200 ) . style ( "opacity" , 1 )
247259 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" ) ) )
248266 }
249267 const currentId = d . id
250268 const linkNodes = d3
You can’t perform that action at this time.
0 commit comments