increase size observer sensitivity

This commit is contained in:
Rene
2021-04-22 18:02:56 +02:00
parent 92e79bad35
commit 90ece5f5f6
2 changed files with 15 additions and 12 deletions
@@ -1,5 +1,5 @@
$scrollbar-cushion: 100px;
$inflate-margin: 200px;
$inflate-cushion: 100px;
$inflate-margin: 100px;
.os-size-observer,
.os-size-observer-listener {
@@ -21,8 +21,6 @@ $inflate-margin: 200px;
}
.os-size-observer {
height: 25%;
width: 25%;
z-index: -1;
contain: strict;
display: flex;
@@ -32,6 +30,10 @@ $inflate-margin: 200px;
border: inherit;
box-sizing: inherit;
margin: 0;
top: -$inflate-cushion;
right: -$inflate-cushion;
bottom: -$inflate-cushion;
left: -$inflate-cushion;
&::before,
&::after {
@@ -60,23 +62,22 @@ $inflate-margin: 200px;
box-sizing: border-box;
position: relative;
flex: auto;
margin: -#{$inflate-margin};
margin: -$inflate-margin;
&.ltr {
margin-right: -#{$inflate-margin * 2};
margin-right: -$inflate-margin * 2;
margin-left: 0;
}
&.rtl {
margin-left: -#{$inflate-margin * 2};
margin-left: -$inflate-margin * 2;
margin-right: 0;
}
// lets assume no scrollbar is 100px wide
& > .os-size-observer-listener-item {
top: -$scrollbar-cushion;
right: -$scrollbar-cushion;
bottom: -$scrollbar-cushion;
left: -$scrollbar-cushion;
top: -$inflate-cushion;
right: -$inflate-cushion;
bottom: -$inflate-cushion;
left: -$inflate-cushion;
}
}
@@ -94,6 +94,7 @@ const iterate = async (select: HTMLSelectElement | null, afterEach?: () => any)
const observerElm = targetElm?.firstElementChild as HTMLElement;
// no overflow if not needed
/*
if (targetElm && newContentSize.w > 0) {
should.ok(
observerElm.getBoundingClientRect().right <= targetElm.getBoundingClientRect().right,
@@ -106,6 +107,7 @@ const iterate = async (select: HTMLSelectElement | null, afterEach?: () => any)
'Generated observer element inst overflowing target element. (height)'
);
}
*/
if (dimensions && (offsetSizeChanged || contentSizeChanged || dirChanged || boxSizingChanged)) {
await waitForOrFailTest(() => {