mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 15:09:59 +02:00
Merge branch 'main' of https://github.com/zen-browser/components
This commit is contained in:
commit
d840faf90d
1 changed files with 16 additions and 12 deletions
|
@ -82,11 +82,13 @@ var gZenBrowserManagerSidebar = {
|
||||||
}
|
}
|
||||||
newSize = Math.max(minSize, Math.min(currentMax, maxWrapperSize,newSize));
|
newSize = Math.max(minSize, Math.min(currentMax, maxWrapperSize,newSize));
|
||||||
|
|
||||||
if (reverse) {
|
window.requestAnimationFrame(() => {
|
||||||
const actualMoved = newSize - sidebarSizeStart;
|
if (reverse) {
|
||||||
this.sidebar.style[toAdjust] = (sidebarPosStart - actualMoved) + 'px';
|
const actualMoved = newSize - sidebarSizeStart;
|
||||||
}
|
this.sidebar.style[toAdjust] = (sidebarPosStart - actualMoved) + 'px';
|
||||||
this.sidebar.style[direction] = `${newSize}px`;
|
}
|
||||||
|
this.sidebar.style[direction] = `${newSize}px`;
|
||||||
|
});
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
document.addEventListener('mousemove', mouseMove);
|
document.addEventListener('mousemove', mouseMove);
|
||||||
|
@ -112,15 +114,17 @@ var gZenBrowserManagerSidebar = {
|
||||||
const topMouseOffset = startTop - mouseDownEvent.screenY;
|
const topMouseOffset = startTop - mouseDownEvent.screenY;
|
||||||
const leftMouseOffset = startLeft - mouseDownEvent.screenX;
|
const leftMouseOffset = startLeft - mouseDownEvent.screenX;
|
||||||
const moveListener = (mouseMoveEvent) => {
|
const moveListener = (mouseMoveEvent) => {
|
||||||
let top = mouseMoveEvent.screenY + topMouseOffset;
|
window.requestAnimationFrame(() => {
|
||||||
let left = mouseMoveEvent.screenX + leftMouseOffset;
|
let top = mouseMoveEvent.screenY + topMouseOffset;
|
||||||
|
let left = mouseMoveEvent.screenX + leftMouseOffset;
|
||||||
|
|
||||||
const wrapperBounds = this.sidebarWrapper.getBoundingClientRect();
|
const wrapperBounds = this.sidebarWrapper.getBoundingClientRect();
|
||||||
top = Math.max(0, Math.min(top, wrapperBounds.height - sideBarHeight));
|
top = Math.max(0, Math.min(top, wrapperBounds.height - sideBarHeight));
|
||||||
left = Math.max(0, Math.min(left, wrapperBounds.width - sideBarWidth));
|
left = Math.max(0, Math.min(left, wrapperBounds.width - sideBarWidth));
|
||||||
|
|
||||||
this.sidebar.style.top = top + 'px';
|
this.sidebar.style.top = top + 'px';
|
||||||
this.sidebar.style.left = left + 'px';
|
this.sidebar.style.left = left + 'px';
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue