SHA256
Добавили компактную перерисовку связей V3
This commit is contained in:
@@ -4204,6 +4204,7 @@
|
||||
"menu": "Connections menu",
|
||||
"search": "Find users",
|
||||
"clear_cache": "Clear cache",
|
||||
"compact": "Compact layout",
|
||||
"loading": "Loading connections…",
|
||||
"progress": "Loading connections: {value1}/{value2}",
|
||||
"partial": "Could not load {value1} branches. The rest of the map is available.",
|
||||
|
||||
@@ -4204,6 +4204,7 @@
|
||||
"menu": "Меню связей",
|
||||
"search": "Искать пользователей",
|
||||
"clear_cache": "Очистить кэш",
|
||||
"compact": "Компактнее",
|
||||
"loading": "Загрузка связей…",
|
||||
"progress": "Загрузка связей: {value1}/{value2}",
|
||||
"partial": "Не удалось загрузить {value1} веток. Остальная карта доступна.",
|
||||
|
||||
@@ -56,7 +56,7 @@ export function render({ navigate, route, chrome } = {}) {
|
||||
const scope = explorerCacheScope(authService, state.session.login);
|
||||
if (!retained || retained.scope !== scope) retained = {
|
||||
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;
|
||||
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);
|
||||
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 spacing = session.compact ? 62 : 84;
|
||||
const minNodeGap = session.compact ? 48 : 66;
|
||||
for (const node of pending) {
|
||||
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];
|
||||
@@ -115,9 +117,9 @@ export function render({ navigate, route, chrome } = {}) {
|
||||
const count = Math.max(8, Math.round(6 * ring));
|
||||
for (let i = 0; i < count; i += 1) {
|
||||
const angle = phase + Math.PI * 2 * i / count;
|
||||
const x = base.x + Math.cos(angle) * ring * 84;
|
||||
const y = base.y + Math.sin(angle) * ring * 84;
|
||||
if (occupied.every((p) => Math.hypot(x - p.x, y - p.y) >= 66)) { point = { x, y }; break; }
|
||||
const x = base.x + Math.cos(angle) * ring * spacing;
|
||||
const y = base.y + Math.sin(angle) * ring * spacing;
|
||||
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 };
|
||||
@@ -258,6 +260,16 @@ export function render({ navigate, route, chrome } = {}) {
|
||||
session.depth = (session.depth + 1) % (EXPLORER_MAX_DEPTH + 1);
|
||||
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() {
|
||||
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) });
|
||||
|
||||
Reference in New Issue
Block a user