Avoid rerender on explorer selection
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
PLUGIN="u-navigator"
|
PLUGIN="u-navigator"
|
||||||
VERSION="0.2.5"
|
VERSION="0.2.6"
|
||||||
PKG_DIR="packages"
|
PKG_DIR="packages"
|
||||||
WORK_DIR=".plugin-build"
|
WORK_DIR=".plugin-build"
|
||||||
PKG_NAME="${PLUGIN}-${VERSION}.tgz"
|
PKG_NAME="${PLUGIN}-${VERSION}.tgz"
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
+28
-3
@@ -151,14 +151,16 @@ function renderWindow(win) {
|
|||||||
if (win.kind === 'explorer') renderExplorer(body, win);
|
if (win.kind === 'explorer') renderExplorer(body, win);
|
||||||
if (win.kind === 'properties') renderProperties(body);
|
if (win.kind === 'properties') renderProperties(body);
|
||||||
if (win.kind === 'queue') renderQueue(body);
|
if (win.kind === 'queue') renderQueue(body);
|
||||||
body.scrollTop = win.data.scrollTop || 0;
|
|
||||||
body.scrollLeft = win.data.scrollLeft || 0;
|
|
||||||
body.addEventListener('scroll', () => {
|
body.addEventListener('scroll', () => {
|
||||||
win.data.scrollTop = body.scrollTop;
|
win.data.scrollTop = body.scrollTop;
|
||||||
win.data.scrollLeft = body.scrollLeft;
|
win.data.scrollLeft = body.scrollLeft;
|
||||||
});
|
});
|
||||||
|
|
||||||
el.append(titlebar, body);
|
el.append(titlebar, body);
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
body.scrollTop = win.data.scrollTop || 0;
|
||||||
|
body.scrollLeft = win.data.scrollLeft || 0;
|
||||||
|
});
|
||||||
if (!win.maximized) {
|
if (!win.maximized) {
|
||||||
const resize = document.createElement('div');
|
const resize = document.createElement('div');
|
||||||
resize.className = 'resize-handle';
|
resize.className = 'resize-handle';
|
||||||
@@ -462,12 +464,35 @@ function selectEntry(win, entry) {
|
|||||||
win.data.selectedPath = entry.path;
|
win.data.selectedPath = entry.path;
|
||||||
state.selectedEntry = entry;
|
state.selectedEntry = entry;
|
||||||
focusWindow(win);
|
focusWindow(win);
|
||||||
render();
|
updateSelectedRows();
|
||||||
|
updatePropertiesWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
function focusWindow(win) {
|
function focusWindow(win) {
|
||||||
state.focusedId = win.id;
|
state.focusedId = win.id;
|
||||||
win.zIndex = ++state.zIndex;
|
win.zIndex = ++state.zIndex;
|
||||||
|
for (const windowEl of workspace.querySelectorAll('.window')) {
|
||||||
|
windowEl.classList.toggle('focused', windowEl.dataset.windowId === win.id);
|
||||||
|
}
|
||||||
|
const current = workspace.querySelector(`.window[data-window-id="${win.id}"]`);
|
||||||
|
if (current) {
|
||||||
|
current.style.zIndex = win.zIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateSelectedRows() {
|
||||||
|
for (const row of workspace.querySelectorAll('.file-row')) {
|
||||||
|
row.classList.toggle('selected', row.dataset.path === state.selectedEntry?.path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updatePropertiesWindows() {
|
||||||
|
for (const win of state.windows.filter((item) => item.kind === 'properties')) {
|
||||||
|
const body = workspace.querySelector(`.window[data-window-id="${win.id}"] .window-body`);
|
||||||
|
if (body) {
|
||||||
|
renderProperties(body);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function startDragWindow(event, win) {
|
function startDragWindow(event, win) {
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE PLUGIN [
|
<!DOCTYPE PLUGIN [
|
||||||
<!ENTITY name "u-navigator">
|
<!ENTITY name "u-navigator">
|
||||||
<!ENTITY author "michael">
|
<!ENTITY author "michael">
|
||||||
<!ENTITY version "0.2.5">
|
<!ENTITY version "0.2.6">
|
||||||
<!ENTITY package "&name;-&version;.tgz">
|
<!ENTITY package "&name;-&version;.tgz">
|
||||||
]>
|
]>
|
||||||
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/u-navigator.plg">
|
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/u-navigator.plg">
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
<FILE Name="/boot/config/plugins/&name;/&package;">
|
<FILE Name="/boot/config/plugins/&name;/&package;">
|
||||||
<URL>https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/packages/&package;</URL>
|
<URL>https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/packages/&package;</URL>
|
||||||
<MD5>41311370d7a9df875faf70da6b5a7ded</MD5>
|
<MD5>56421a769bd45a076d4d38f3e70aa90e</MD5>
|
||||||
</FILE>
|
</FILE>
|
||||||
|
|
||||||
<FILE Run="/bin/bash">
|
<FILE Run="/bin/bash">
|
||||||
|
|||||||
Reference in New Issue
Block a user