cosmetics
This commit is contained in:
parent
78e0a87b96
commit
ef922ee862
|
@ -6,6 +6,7 @@
|
|||
(function HeaderResizer() {
|
||||
const el = $('#header-resizer');
|
||||
let lastW, lastX;
|
||||
|
||||
el.onmousedown = e => {
|
||||
if (e.button) return;
|
||||
lastW = $('#header').clientWidth;
|
||||
|
@ -14,18 +15,19 @@
|
|||
document.on('mousemove', resize);
|
||||
document.on('mouseup', resizeStop);
|
||||
};
|
||||
|
||||
function resize({clientX: x}) {
|
||||
const w = editor.updateHeaderWidth(lastW + x - lastX);
|
||||
const delta = w - lastW;
|
||||
if (delta) {
|
||||
lastW = w;
|
||||
lastX = x;
|
||||
prefs.set('editor.headerWidth', w);
|
||||
for (const el of $$('.CodeMirror-linewidget[style*="width:"]')) {
|
||||
el.style.width = parseFloat(el.style.width) - delta + 'px';
|
||||
}
|
||||
if (!delta) return;
|
||||
lastW = w;
|
||||
lastX = x;
|
||||
prefs.set('editor.headerWidth', w);
|
||||
for (const el of $$('.CodeMirror-linewidget[style*="width:"]')) {
|
||||
el.style.width = parseFloat(el.style.width) - delta + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
function resizeStop() {
|
||||
document.off('mouseup', resizeStop);
|
||||
document.off('mousemove', resize);
|
||||
|
|
Loading…
Reference in New Issue
Block a user