Little improvment on Apps drag behavior

This commit is contained in:
Rotimi Best
2023-10-05 10:32:57 +01:00
parent 804e5cdeb9
commit 195ac54467
+3 -5
View File
@@ -68,11 +68,10 @@
} }
function startDragging(event) { function startDragging(event) {
if (!getResizableSidebar()) return;
if (event.button === 0 && selectedApp) { if (event.button === 0 && selectedApp) {
event.preventDefault(); event.preventDefault();
const isNearLeftBorder = event.clientX - appContentRef.getBoundingClientRect().left < 8; const isNearLeftBorder = event.clientX - appContentRef.getBoundingClientRect().left < 5;
const isNearRightBorder = appContentRef.getBoundingClientRect().right - event.clientX < 8; const isNearRightBorder = appContentRef.getBoundingClientRect().right - event.clientX < 5;
if ( if (
(isNearRightBorder || isNearLeftBorder) && (isNearRightBorder || isNearLeftBorder) &&
@@ -88,7 +87,6 @@
} }
function stopDragging() { function stopDragging() {
if (!getResizableSidebar()) return;
isDragging = false; isDragging = false;
resize = false; resize = false;
} }
@@ -98,7 +96,7 @@
if (!isDragging || !selectedApp) return; if (!isDragging || !selectedApp) return;
const deltaX = startX - event.clientX + 60; const deltaX = startX - event.clientX + 60;
let newWidth = initialWidth + deltaX; let newWidth = initialWidth + deltaX;
if (newWidth <= 100) { if (newWidth <= 250) {
handleClose(); handleClose();
appBarRef.style.width = '60px'; appBarRef.style.width = '60px';
appContentRef.style.width = '0'; appContentRef.style.width = '0';