Refactor and fix too long page bug

This commit is contained in:
Andras Schmelczer 2022-09-25 18:08:55 +02:00
parent ef30dbd7f0
commit 78dd507be4
No known key found for this signature in database
GPG key ID: 0EA1BC97D0AB076E
3 changed files with 15 additions and 12 deletions

View file

@ -1,11 +1,12 @@
export const getHeight = (e: HTMLElement): number => {
// ignores margin collapse
const computedStyle = getComputedStyle(e);
return (
e.clientHeight +
parseInt(computedStyle.marginTop) +
parseInt(computedStyle.marginBottom) +
parseInt(computedStyle.borderTopWidth) +
parseInt(computedStyle.borderBottomWidth)
parseFloat(computedStyle.marginTop) +
parseFloat(computedStyle.marginBottom) +
parseFloat(computedStyle.borderTopWidth) +
parseFloat(computedStyle.borderBottomWidth)
);
};

View file

@ -1,2 +1,2 @@
export const mix = (from: number, to: number, q: number): number =>
from * (1 - q) + to * q;
from + (to - from) * q;