SHA256
Добавили компактную перерисовку связей V3
This commit is contained in:
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
client.version=1.20.32
|
client.version=1.20.33
|
||||||
server.version=1.16.19
|
server.version=1.16.19
|
||||||
|
|||||||
@@ -4204,6 +4204,7 @@
|
|||||||
"menu": "Connections menu",
|
"menu": "Connections menu",
|
||||||
"search": "Find users",
|
"search": "Find users",
|
||||||
"clear_cache": "Clear cache",
|
"clear_cache": "Clear cache",
|
||||||
|
"compact": "Compact layout",
|
||||||
"loading": "Loading connections…",
|
"loading": "Loading connections…",
|
||||||
"progress": "Loading connections: {value1}/{value2}",
|
"progress": "Loading connections: {value1}/{value2}",
|
||||||
"partial": "Could not load {value1} branches. The rest of the map is available.",
|
"partial": "Could not load {value1} branches. The rest of the map is available.",
|
||||||
|
|||||||
@@ -4204,6 +4204,7 @@
|
|||||||
"menu": "Меню связей",
|
"menu": "Меню связей",
|
||||||
"search": "Искать пользователей",
|
"search": "Искать пользователей",
|
||||||
"clear_cache": "Очистить кэш",
|
"clear_cache": "Очистить кэш",
|
||||||
|
"compact": "Компактнее",
|
||||||
"loading": "Загрузка связей…",
|
"loading": "Загрузка связей…",
|
||||||
"progress": "Загрузка связей: {value1}/{value2}",
|
"progress": "Загрузка связей: {value1}/{value2}",
|
||||||
"partial": "Не удалось загрузить {value1} веток. Остальная карта доступна.",
|
"partial": "Не удалось загрузить {value1} веток. Остальная карта доступна.",
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export function render({ navigate, route, chrome } = {}) {
|
|||||||
const scope = explorerCacheScope(authService, state.session.login);
|
const scope = explorerCacheScope(authService, state.session.login);
|
||||||
if (!retained || retained.scope !== scope) retained = {
|
if (!retained || retained.scope !== scope) retained = {
|
||||||
scope, graph: createExplorerGraph(), positions: new Map(), center: '',
|
scope, graph: createExplorerGraph(), positions: new Map(), center: '',
|
||||||
depth: EXPLORER_DEFAULT_DEPTH, x2: false, close: false, shining: false,
|
depth: EXPLORER_DEFAULT_DEPTH, x2: false, close: false, shining: false, compact: false,
|
||||||
};
|
};
|
||||||
const session = retained;
|
const session = retained;
|
||||||
let centerLogin = normalizeLogin(route?.params?.login || session.center || state.session.login);
|
let centerLogin = normalizeLogin(route?.params?.login || session.center || state.session.login);
|
||||||
@@ -105,6 +105,8 @@ export function render({ navigate, route, chrome } = {}) {
|
|||||||
const center = keyOf(centerLogin);
|
const center = keyOf(centerLogin);
|
||||||
if (!session.positions.has(center)) session.positions.set(center, { x: 0, y: 0 });
|
if (!session.positions.has(center)) session.positions.set(center, { x: 0, y: 0 });
|
||||||
const pending = nodes.filter((node) => !session.positions.has(node.id)).sort((a, b) => a.distance - b.distance);
|
const pending = nodes.filter((node) => !session.positions.has(node.id)).sort((a, b) => a.distance - b.distance);
|
||||||
|
const spacing = session.compact ? 62 : 84;
|
||||||
|
const minNodeGap = session.compact ? 48 : 66;
|
||||||
for (const node of pending) {
|
for (const node of pending) {
|
||||||
const connected = (adjacency.get(node.id) || []).filter((id) => session.positions.has(id));
|
const connected = (adjacency.get(node.id) || []).filter((id) => session.positions.has(id));
|
||||||
const nearest = connected.sort((a, b) => (byId.get(a)?.distance ?? 99) - (byId.get(b)?.distance ?? 99))[0];
|
const nearest = connected.sort((a, b) => (byId.get(a)?.distance ?? 99) - (byId.get(b)?.distance ?? 99))[0];
|
||||||
@@ -115,9 +117,9 @@ export function render({ navigate, route, chrome } = {}) {
|
|||||||
const count = Math.max(8, Math.round(6 * ring));
|
const count = Math.max(8, Math.round(6 * ring));
|
||||||
for (let i = 0; i < count; i += 1) {
|
for (let i = 0; i < count; i += 1) {
|
||||||
const angle = phase + Math.PI * 2 * i / count;
|
const angle = phase + Math.PI * 2 * i / count;
|
||||||
const x = base.x + Math.cos(angle) * ring * 84;
|
const x = base.x + Math.cos(angle) * ring * spacing;
|
||||||
const y = base.y + Math.sin(angle) * ring * 84;
|
const y = base.y + Math.sin(angle) * ring * spacing;
|
||||||
if (occupied.every((p) => Math.hypot(x - p.x, y - p.y) >= 66)) { point = { x, y }; break; }
|
if (occupied.every((p) => Math.hypot(x - p.x, y - p.y) >= minNodeGap)) { point = { x, y }; break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
point ||= { x: base.x + 300, y: base.y + 300 };
|
point ||= { x: base.x + 300, y: base.y + 300 };
|
||||||
@@ -258,6 +260,16 @@ 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'), () => {
|
||||||
|
if (session.compact) return;
|
||||||
|
session.compact = true;
|
||||||
|
for (const [id, point] of session.positions) {
|
||||||
|
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();
|
||||||
|
}, 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) });
|
||||||
|
|||||||
Reference in New Issue
Block a user