more reliable centering of the popup in FF
This commit is contained in:
parent
a8f292815a
commit
3178ee9f10
|
@ -117,17 +117,15 @@ window.addEventListener('showStyles:done', function _() {
|
||||||
addEventListener('scroll', loadMoreIfNeeded, {passive: true});
|
addEventListener('scroll', loadMoreIfNeeded, {passive: true});
|
||||||
|
|
||||||
if (FIREFOX) {
|
if (FIREFOX) {
|
||||||
let lastScrollbarWidth;
|
let lastShift;
|
||||||
addEventListener('resize', () => {
|
addEventListener('resize', () => {
|
||||||
const scrollbarWidth = window.innerWidth - document.scrollingElement.clientWidth;
|
const scrollbarWidth = window.innerWidth - document.scrollingElement.clientWidth;
|
||||||
if (lastScrollbarWidth !== scrollbarWidth) {
|
const shift = document.body.getBoundingClientRect().left;
|
||||||
lastScrollbarWidth = scrollbarWidth;
|
if (!scrollbarWidth || shift === lastShift) return;
|
||||||
dom.marginLeft = dom.marginLeft || parseFloat(getComputedStyle(dom.container).marginLeft);
|
lastShift = shift;
|
||||||
const shift = dom.container.getBoundingClientRect().left - dom.marginLeft;
|
|
||||||
document.body.style.setProperty('padding',
|
document.body.style.setProperty('padding',
|
||||||
`0 ${scrollbarWidth - shift}px 0 ${shift}px`, 'important');
|
`0 ${scrollbarWidth + shift}px 0 ${-shift}px`, 'important');
|
||||||
}
|
}, {passive: true});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addEventListener('styleDeleted', ({detail: {id}}) => {
|
addEventListener('styleDeleted', ({detail: {id}}) => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user