Skip to content

Commit 8ec7417

Browse files
committed
Dumper: hash highlighting on mouseover
1 parent 13cfb6d commit 8ec7417

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

src/Tracy/Bar/assets/bar.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,14 @@ body#tracy-debug .tracy-panel { /* in popup window */
401401
display: none;
402402
}
403403

404+
#tracy-debug .tracy-dump-highlight {
405+
background: #C22;
406+
color: white;
407+
border-radius: 2px;
408+
padding: 0 2px;
409+
margin: 0 -2px;
410+
}
411+
404412

405413
/* toggle */
406414
#tracy-debug .tracy-toggle:after {

src/Tracy/Dumper/assets/dumper.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ pre.tracy-dump a:focus {
5555
display: none;
5656
}
5757

58+
.tracy-dump-highlight {
59+
background: #C22;
60+
color: white;
61+
border-radius: 2px;
62+
padding: 0 2px;
63+
margin: 0 -2px;
64+
}
65+
5866
span[data-tracy-href] {
5967
border-bottom: 1px dotted rgba(0, 0, 0, .2);
6068
}

src/Tracy/Dumper/assets/dumper.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,25 @@
6666
}
6767
});
6868

69+
document.addEventListener('mouseover', (e) => {
70+
let dump;
71+
if (e.target.matches('.tracy-dump-hash') && (dump = e.target.closest('.tracy-dump'))) {
72+
dump.querySelectorAll('.tracy-dump-hash').forEach((el) => {
73+
if (el.textContent === e.target.textContent) {
74+
el.classList.add('tracy-dump-highlight');
75+
}
76+
});
77+
}
78+
});
79+
80+
document.addEventListener('mouseout', (e) => {
81+
if (e.target.matches('.tracy-dump-hash')) {
82+
document.querySelectorAll('.tracy-dump-hash.tracy-dump-highlight').forEach((el) => {
83+
el.classList.remove('tracy-dump-highlight');
84+
});
85+
}
86+
});
87+
6988
Tracy.Toggle.init();
7089
}
7190
}

0 commit comments

Comments
 (0)