mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 16:37:02 +03:00
Simplify ResizeObservers
This commit is contained in:
parent
1e71698b79
commit
3c4b3e3b50
1 changed files with 15 additions and 32 deletions
|
|
@ -952,59 +952,42 @@ class AppUser extends AbstractApp {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if ('horizontal' == css.getPropertyValue('resize')) {
|
if ('horizontal' == css.getPropertyValue('resize')) {
|
||||||
source.observer = new window.ResizeObserver(entries => {
|
source.observer = new window.ResizeObserver(() => {
|
||||||
entries.forEach(entry => {
|
target.style.left = source.offsetWidth + 'px';
|
||||||
// target.style.left = entry.borderBoxSize.blockSize + 'px';
|
|
||||||
// target.style.left = source.offsetWidth + 'px';
|
|
||||||
target.style.left = entry.contentRect.width + 'px';
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
source.observer = new window.ResizeObserver(entries => {
|
source.observer = new window.ResizeObserver(() => {
|
||||||
entries.forEach(entry => {
|
target.style.top = (4 + source.offsetTop + source.offsetHeight) + 'px';
|
||||||
// target.style.top = entry.borderBoxSize.inlineSize + 'px';
|
|
||||||
// target.style.top = (4 + source.offsetTop + source.offsetHeight) + 'px';
|
|
||||||
target.style.top = (4 + source.offsetTop + entry.contentRect.height) + 'px';
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
source.observer.observe(source, { box: 'border-box' });
|
source.observer.observe(source, { box: 'border-box' });
|
||||||
}
|
}
|
||||||
source.removeAttribute('style');
|
|
||||||
target.removeAttribute('style');
|
target.removeAttribute('style');
|
||||||
|
source.removeAttribute('style');
|
||||||
}
|
}
|
||||||
|
|
||||||
initHorizontalLayoutResizer() {
|
initHorizontalLayoutResizer() {
|
||||||
let top = window.document.querySelector('.b-message-list-wrapper'),
|
const top = window.document.querySelector('.b-message-list-wrapper'),
|
||||||
bottom = window.document.querySelector('.b-message-view-wrapper');
|
bottom = window.document.querySelector('.b-message-view-wrapper'),
|
||||||
|
fDisable = bDisable => {
|
||||||
|
this.setLayoutResizer(top, bottom, bDisable || !$htmlCL.contains('rl-bottom-preview-pane'));
|
||||||
|
};
|
||||||
if (top && bottom) {
|
if (top && bottom) {
|
||||||
const
|
|
||||||
fDisable = (bDisable) => {
|
|
||||||
this.setLayoutResizer(top, bottom, bDisable || !$htmlCL.contains('rl-bottom-preview-pane'));
|
|
||||||
};
|
|
||||||
|
|
||||||
fDisable(false);
|
fDisable(false);
|
||||||
|
|
||||||
Events.sub('layout', layout => fDisable(Layout.BottomPreview !== layout));
|
Events.sub('layout', layout => fDisable(Layout.BottomPreview !== layout));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initVerticalLayoutResizer() {
|
initVerticalLayoutResizer() {
|
||||||
let left = window.document.getElementById('rl-left'),
|
const left = window.document.getElementById('rl-left'),
|
||||||
right = window.document.getElementById('rl-right');
|
right = window.document.getElementById('rl-right'),
|
||||||
|
fDisable = bDisable => {
|
||||||
|
this.setLayoutResizer(left, right, bDisable);
|
||||||
|
};
|
||||||
if (left && right) {
|
if (left && right) {
|
||||||
const
|
|
||||||
fDisable = bDisable => {
|
|
||||||
this.setLayoutResizer(left, right, bDisable);
|
|
||||||
};
|
|
||||||
|
|
||||||
fDisable(false);
|
fDisable(false);
|
||||||
|
|
||||||
Events.sub('left-panel.off', () => fDisable(true));
|
Events.sub('left-panel.off', () => fDisable(true));
|
||||||
|
|
||||||
Events.sub('left-panel.on', () => fDisable(false));
|
Events.sub('left-panel.on', () => fDisable(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue