mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-09 10:50:42 +00:00
parent
bbb0f7de38
commit
cbe7d47cdd
@ -43,7 +43,8 @@ class MathjaxExplanation extends MathjaxAdapter {
|
|||||||
// scroll to element if needed
|
// scroll to element if needed
|
||||||
const hostEl = this.shadowRoot!.host as HTMLElement;
|
const hostEl = this.shadowRoot!.host as HTMLElement;
|
||||||
const dy = el.offsetTop - hostEl.offsetTop - hostEl.scrollTop;
|
const dy = el.offsetTop - hostEl.offsetTop - hostEl.scrollTop;
|
||||||
if (dy > hostEl.offsetHeight || dy < 0) {
|
// end of text is below the container or the start of the text is above the container:
|
||||||
|
if (dy + el.offsetHeight > hostEl.offsetHeight || dy < 0) {
|
||||||
hostEl.scrollBy(0, -hostEl.scrollTop + el.offsetTop - hostEl.offsetTop);
|
hostEl.scrollBy(0, -hostEl.scrollTop + el.offsetTop - hostEl.offsetTop);
|
||||||
}
|
}
|
||||||
el.style.opacity = "1.0";
|
el.style.opacity = "1.0";
|
||||||
|
Loading…
Reference in New Issue
Block a user