fix sidenote tiling bug

This commit is contained in:
2022-05-14 13:30:11 -07:00
parent 7e5960c14a
commit ca903e2d15
3 changed files with 19 additions and 10 deletions

View File

@ -7,11 +7,13 @@
.counter {
counter-increment: sidenote;
color: #444;
margin-left: 0.05rem;
&:after {
font-size: 0.75rem;
position: relative;
bottom: 0.3rem;
color: #8c0606;
}
}
@ -23,6 +25,7 @@
position: relative;
font-size: 0.75rem;
bottom: 0.2rem;
color: #8c0606;
}
}
@ -103,7 +106,14 @@
return;
}
let labelTop = s.label.getBoundingClientRect().y + window.scrollY;
let labelTop = s.label.getBoundingClientRect().y;
if (labelTop === 0) {
// sometimes we get spurious results, only in dev mode though
// I think it's related to hot module reloading
return;
}
labelTop += window.scrollY;
let noteHeight = s.note.getBoundingClientRect().height;
if (labelTop < prevBottom + minNoteGap) {
// there is a collision