Fix resizing issues
This commit is contained in:
@@ -494,6 +494,8 @@ function toggleSHSB(force = undefined) {
|
||||
|
||||
if (force !== undefined) {
|
||||
if (force) {
|
||||
|
||||
setVar("sb_state", "closed");
|
||||
side_bar.classList.add('closed');
|
||||
clearIcon.classList.add('closed');
|
||||
searchCategoryIcon.classList.add('closed');
|
||||
@@ -502,6 +504,8 @@ function toggleSHSB(force = undefined) {
|
||||
sidebar_views.classList.add('full_rounded');
|
||||
|
||||
} else {
|
||||
|
||||
setVar("sb_state", "open");
|
||||
side_bar.classList.remove('closed');
|
||||
clearIcon.classList.remove('closed');
|
||||
searchCategoryIcon.classList.remove('closed');
|
||||
@@ -513,6 +517,9 @@ function toggleSHSB(force = undefined) {
|
||||
} else {
|
||||
|
||||
if (side_bar.classList.contains('closed')) {
|
||||
|
||||
setVar("sb_state", "open");
|
||||
|
||||
side_bar.classList.remove('closed');
|
||||
clearIcon.classList.remove('closed');
|
||||
searchCategoryIcon.classList.remove('closed');
|
||||
@@ -526,6 +533,8 @@ function toggleSHSB(force = undefined) {
|
||||
|
||||
} else {
|
||||
if (getVar("sb_minimized") == "false") {
|
||||
|
||||
setVar("sb_state", "closed");
|
||||
side_bar.classList.add('closed');
|
||||
clearIcon.classList.add('closed');
|
||||
searchCategoryIcon.classList.add('closed');
|
||||
@@ -546,19 +555,28 @@ function toggleSHSB(force = undefined) {
|
||||
if (getVar("sb_minimized") == "false") {
|
||||
|
||||
if (force == undefined) {
|
||||
|
||||
setVar("sb_state", "closed");
|
||||
setVar("sb_minimized", true);
|
||||
}
|
||||
main_sidebar.style.width = '45px';
|
||||
} else {
|
||||
|
||||
if (force == undefined) {
|
||||
|
||||
setVar("sb_state", "open");
|
||||
setVar("sb_minimized", false);
|
||||
main_sidebar.style.width = getVar("sidebarWidth") + 'px' || '300px';
|
||||
} else if (force == true) {
|
||||
|
||||
|
||||
setVar("sb_state", "closed");
|
||||
|
||||
main_sidebar.style.width = '45px';
|
||||
|
||||
} else {
|
||||
|
||||
setVar("sb_state", "open");
|
||||
main_sidebar.style.width = getVar("sidebarWidth") + 'px' || '300px';
|
||||
}
|
||||
|
||||
|
||||
+14
-3
@@ -141,8 +141,18 @@ function saveSidebarPosition(sideb) {
|
||||
|
||||
function restoreSidebarWidth() {
|
||||
if (getVar("sidebarWidth") == null) {
|
||||
setVar("sidebarWidth", 200);
|
||||
setVar("sidebarWidth", 400);
|
||||
|
||||
|
||||
}
|
||||
if (getVar("sb_minimized") == null) {
|
||||
setVar("sb_minimized", "true");
|
||||
}
|
||||
if (getVar("sb_current_tab") == null) {
|
||||
setVar("sb_current_tab", "panel_home");
|
||||
|
||||
}
|
||||
|
||||
let width_sidebar = "auto";
|
||||
let cookieValue = getVar("sidebarWidth");
|
||||
if (cookieValue) {
|
||||
@@ -665,7 +675,8 @@ Object.keys(dragHandles).forEach(handleId => {
|
||||
if (handleId === "sidebar_views") {
|
||||
if (!event.altKey) return; // Gestisci l'eccezione altKey per sidebar_views
|
||||
element.style.cursor = 'n-resize'; // Cambia cursore quando alt è premuto
|
||||
} else if (handleId === "dragHandle" && localStorage.getItem("sb_minimized") === "true") {
|
||||
} else if (handleId === "dragHandle" && localStorage.getItem("sb_state") === "closed") {
|
||||
|
||||
return; // Gestisci l'eccezione minimized
|
||||
} else {
|
||||
element.style.cursor = ''; // Cambia cursore per gli altri handle
|
||||
@@ -733,7 +744,7 @@ document.addEventListener("mousemove", function (event) {
|
||||
|
||||
// Funzioni per gestire gli eventi touch
|
||||
dragHandle.addEventListener("touchstart", function (event) {
|
||||
if (localStorage.getItem("sb_minimized")==="false")
|
||||
if (localStorage.getItem("sb_state") === "open")
|
||||
{
|
||||
isDragging = true;
|
||||
startX = event.touches[0].clientX;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfyui-n-sidebar"
|
||||
description = "A simple sidebar for ComfyUI."
|
||||
version = "1.5.5"
|
||||
version = "1.5.6"
|
||||
license = { file = "LICENSE" }
|
||||
|
||||
[project.urls]
|
||||
|
||||
Reference in New Issue
Block a user