Merge pull request #2891 from ehuss/divide-by-zero-heading-bug
Avoid divide-by-zero in heading nav computation
This commit is contained in:
commit
a097fe6232
1 changed files with 1 additions and 1 deletions
|
|
@ -127,7 +127,7 @@ window.customElements.define('mdbook-sidebar-scrollbox', MDBookSidebarScrollbox)
|
||||||
// proportional to the difference in size.
|
// proportional to the difference in size.
|
||||||
if (documentHeight < windowHeight * 2) {
|
if (documentHeight < windowHeight * 2) {
|
||||||
const maxPixelsBelow = documentHeight - windowHeight;
|
const maxPixelsBelow = documentHeight - windowHeight;
|
||||||
const t = 1 - pixelsBelow / maxPixelsBelow;
|
const t = 1 - pixelsBelow / Math.max(1, maxPixelsBelow);
|
||||||
const clamp = Math.max(0, Math.min(1, t));
|
const clamp = Math.max(0, Math.min(1, t));
|
||||||
adjustedBottomAdd *= clamp;
|
adjustedBottomAdd *= clamp;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue