mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-13 08:43:08 -07:00
WebUI: implement debounce behavior for resize events
This commit is contained in:
parent
0c580c3174
commit
29379232aa
6 changed files with 43 additions and 31 deletions
|
@ -165,11 +165,11 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
LocalPreferences.set("properties_height_rel", properties_height_rel);
|
||||
};
|
||||
|
||||
window.addEventListener("resize", () => {
|
||||
window.addEventListener("resize", window.qBittorrent.Misc.createDebounceHandler(500, (e) => {
|
||||
// only save sizes if the columns are visible
|
||||
if (!$("mainColumn").hasClass("invisible"))
|
||||
saveColumnSizes.delay(200); // Resizing might takes some time.
|
||||
});
|
||||
saveColumnSizes();
|
||||
}));
|
||||
|
||||
/* MochaUI.Desktop = new MochaUI.Desktop();
|
||||
MochaUI.Desktop.desktop.style.background = "#fff";
|
||||
|
@ -181,7 +181,9 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
new MochaUI.Column({
|
||||
id: "filtersColumn",
|
||||
placement: "left",
|
||||
onResize: saveColumnSizes,
|
||||
onResize: window.qBittorrent.Misc.createDebounceHandler(500, (e) => {
|
||||
saveColumnSizes();
|
||||
}),
|
||||
width: filt_w,
|
||||
resizeLimit: [1, 300]
|
||||
});
|
||||
|
@ -1449,7 +1451,9 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
updateMainData();
|
||||
},
|
||||
column: "mainColumn",
|
||||
onResize: saveColumnSizes,
|
||||
onResize: window.qBittorrent.Misc.createDebounceHandler(500, (e) => {
|
||||
saveColumnSizes();
|
||||
}),
|
||||
height: null
|
||||
});
|
||||
let prop_h = LocalPreferences.get("properties_height_rel");
|
||||
|
@ -1614,9 +1618,9 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
paddingHorizontal: 0,
|
||||
width: loadWindowWidth(id, 500),
|
||||
height: loadWindowHeight(id, 460),
|
||||
onResize: () => {
|
||||
onResize: window.qBittorrent.Misc.createDebounceHandler(500, (e) => {
|
||||
saveWindowSize(id);
|
||||
},
|
||||
}),
|
||||
onContentLoaded: () => {
|
||||
const fileInput = $(`${id}_iframe`).contentDocument.getElementById("fileselect");
|
||||
fileInput.files = droppedFiles;
|
||||
|
@ -1658,9 +1662,9 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
paddingHorizontal: 0,
|
||||
width: loadWindowWidth(id, 500),
|
||||
height: loadWindowHeight(id, 600),
|
||||
onResize: () => {
|
||||
onResize: window.qBittorrent.Misc.createDebounceHandler(500, (e) => {
|
||||
saveWindowSize(id);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue