Исправили кнопку компактной перерисовки

This commit is contained in:
AidarKC
2026-11-11 01:19:53 +03:00
parent d39d2777d1
commit 6b120731a3
2 changed files with 12 additions and 9 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
client.version=1.20.33 client.version=1.20.34
server.version=1.16.19 server.version=1.16.19
@@ -238,6 +238,14 @@ export function render({ navigate, route, chrome } = {}) {
toolbar.append(element); toolbar.append(element);
return element; return element;
} }
function actionChip(label, fn) {
const element = document.createElement('button');
element.type = 'button'; element.className = 'fg-filter-chip';
element.textContent = label;
element.addEventListener('click', fn);
toolbar.append(element);
return element;
}
const closeChip = chip(t('screens.network_view.text_002'), () => { const closeChip = chip(t('screens.network_view.text_002'), () => {
session.close = !session.close; session.close = !session.close;
closeChip.classList.toggle('is-active', session.close); closeChip.classList.toggle('is-active', session.close);
@@ -260,16 +268,11 @@ export function render({ navigate, route, chrome } = {}) {
session.depth = (session.depth + 1) % (EXPLORER_MAX_DEPTH + 1); session.depth = (session.depth + 1) % (EXPLORER_MAX_DEPTH + 1);
syncDepth(); draw(); syncDepth(); draw();
}); });
const compactChip = chip(t('screens.network_explorer.compact'), () => { actionChip(t('screens.network_explorer.compact'), () => {
if (session.compact) return;
session.compact = true; session.compact = true;
for (const [id, point] of session.positions) { session.positions.clear();
session.positions.set(id, { x: point.x * 0.72, y: point.y * 0.72 });
}
compactChip.classList.add('is-active');
compactChip.setAttribute('aria-pressed', 'true');
draw(); draw();
}, session.compact); });
function syncDepth() { function syncDepth() {
depthChip.textContent = t('screens.network_explorer.depth', { value1: session.depth }); depthChip.textContent = t('screens.network_explorer.depth', { value1: session.depth });
depthChip.title = t('screens.network_explorer.depth_hint', { value1: session.depth + (session.x2 ? 2 : 1) }); depthChip.title = t('screens.network_explorer.depth_hint', { value1: session.depth + (session.x2 ? 2 : 1) });