SHA256
Исправили отображение связей V3
This commit is contained in:
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
client.version=1.20.28
|
client.version=1.20.29
|
||||||
server.version=1.16.19
|
server.version=1.16.19
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ export function createExplorerGraph() {
|
|||||||
// Если граф обновился, старые исходящие рёбра этого владельца больше не действуют.
|
// Если граф обновился, старые исходящие рёбра этого владельца больше не действуют.
|
||||||
for (const edgeKey of edges.keys()) if (edgeKey.startsWith(`${owner}\u0000`)) edges.delete(edgeKey);
|
for (const edgeKey of edges.keys()) if (edgeKey.startsWith(`${owner}\u0000`)) edges.delete(edgeKey);
|
||||||
const close = new Set((graph?.outCloseFriends || []).map(keyOf));
|
const close = new Set((graph?.outCloseFriends || []).map(keyOf));
|
||||||
const inbound = new Set([...(graph?.inFriends || []), ...(graph?.inCloseFriends || [])].map(keyOf));
|
const inboundClose = new Set((graph?.inCloseFriends || []).map(keyOf));
|
||||||
|
const inbound = new Set([...(graph?.inFriends || []), ...inboundClose].map(keyOf));
|
||||||
// Сохраняем оригинальный регистр логина для серверного API (ключи графа
|
// Сохраняем оригинальный регистр логина для серверного API (ключи графа
|
||||||
// нормализуем независимо, только для сопоставления вершин).
|
// нормализуем независимо, только для сопоставления вершин).
|
||||||
const friendNames = new Map();
|
const friendNames = new Map();
|
||||||
@@ -68,6 +69,7 @@ export function createExplorerGraph() {
|
|||||||
remember({ login: friendNames.get(id) }, id);
|
remember({ login: friendNames.get(id) }, id);
|
||||||
edges.set(`${owner}\u0000${id}`, {
|
edges.set(`${owner}\u0000${id}`, {
|
||||||
from: owner, to: id, type: close.has(id) ? 'close_friend' : 'friend',
|
from: owner, to: id, type: close.has(id) ? 'close_friend' : 'friend',
|
||||||
|
reverseType: inboundClose.has(id) ? 'close_friend' : (inbound.has(id) ? 'friend' : null),
|
||||||
mutual: inbound.has(id),
|
mutual: inbound.has(id),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -162,7 +164,8 @@ export function createExplorerGraph() {
|
|||||||
if (!isExpanded(edge.from) && !isExpanded(edge.to)) continue;
|
if (!isExpanded(edge.from) && !isExpanded(edge.to)) continue;
|
||||||
const detail = {
|
const detail = {
|
||||||
id: parent,
|
id: parent,
|
||||||
relationType: edge.type === 'close_friend' || reverse?.type === 'close_friend' ? 'close_friend' : 'friend',
|
relationType: edge.type,
|
||||||
|
reverseRelationType: reverse?.type || edge.reverseType || null,
|
||||||
mutual: Boolean(edge.mutual || reverse),
|
mutual: Boolean(edge.mutual || reverse),
|
||||||
strength: edge.type === 'close_friend' ? 0.9 : 0.55,
|
strength: edge.type === 'close_friend' ? 0.9 : 0.55,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ const DOUBLE_TAP_MS = 320; // окно двойного тапа по фо
|
|||||||
const RELATION_COLORS = {
|
const RELATION_COLORS = {
|
||||||
family: 'rgba(255, 159, 94, 0.92)',
|
family: 'rgba(255, 159, 94, 0.92)',
|
||||||
friend: 'rgba(120, 179, 255, 0.9)',
|
friend: 'rgba(120, 179, 255, 0.9)',
|
||||||
close_friend: 'rgba(120, 179, 255, 0.98)',
|
close_friend: 'rgba(255, 76, 92, 0.98)',
|
||||||
business: 'rgba(190, 150, 255, 0.9)',
|
business: 'rgba(190, 150, 255, 0.9)',
|
||||||
contact: 'rgba(170, 190, 220, 0.7)',
|
contact: 'rgba(170, 190, 220, 0.7)',
|
||||||
};
|
};
|
||||||
@@ -110,7 +110,7 @@ function easeOutCubic(t) {
|
|||||||
const RELATION_COLORS_LIGHT = {
|
const RELATION_COLORS_LIGHT = {
|
||||||
family: 'rgba(184, 92, 20, 0.9)',
|
family: 'rgba(184, 92, 20, 0.9)',
|
||||||
friend: 'rgba(38, 96, 196, 0.9)',
|
friend: 'rgba(38, 96, 196, 0.9)',
|
||||||
close_friend: 'rgba(38, 96, 196, 0.98)',
|
close_friend: 'rgba(214, 38, 55, 0.98)',
|
||||||
business: 'rgba(108, 62, 200, 0.9)',
|
business: 'rgba(108, 62, 200, 0.9)',
|
||||||
contact: 'rgba(92, 98, 121, 0.75)',
|
contact: 'rgba(92, 98, 121, 0.75)',
|
||||||
};
|
};
|
||||||
@@ -971,6 +971,8 @@ export function createForceGraph({ stage, model, onCenterTap, onNodeTap, onNodeL
|
|||||||
function renderHistoryEdges() {
|
function renderHistoryEdges() {
|
||||||
const Z = zoom;
|
const Z = zoom;
|
||||||
const parts = [];
|
const parts = [];
|
||||||
|
const defs = [];
|
||||||
|
let gradientIndex = 0;
|
||||||
const tx = (n) => centerX + camX + n.x * Z;
|
const tx = (n) => centerX + camX + n.x * Z;
|
||||||
const ty = (n) => centerY + camY + n.y * Z;
|
const ty = (n) => centerY + camY + n.y * Z;
|
||||||
|
|
||||||
@@ -1014,6 +1016,7 @@ export function createForceGraph({ stage, model, onCenterTap, onNodeTap, onNodeL
|
|||||||
const cpx = 2 * desX - mx;
|
const cpx = 2 * desX - mx;
|
||||||
const cpy = 2 * desY - my;
|
const cpy = 2 * desY - my;
|
||||||
const relationType = String(ref?.relationType || n.relationType || 'contact');
|
const relationType = String(ref?.relationType || n.relationType || 'contact');
|
||||||
|
const reverseRelationType = String(ref?.reverseRelationType || '');
|
||||||
const strength = Math.max(0, Math.min(1, Number(ref?.strength) || Number(n.strength) || 0.5));
|
const strength = Math.max(0, Math.min(1, Number(ref?.strength) || Number(n.strength) || 0.5));
|
||||||
const opacity = Math.min(childOpacity, parentOpacity);
|
const opacity = Math.min(childOpacity, parentOpacity);
|
||||||
const shine = Boolean(parent.shining && n.shining) && !n.hidden;
|
const shine = Boolean(parent.shining && n.shining) && !n.hidden;
|
||||||
@@ -1022,6 +1025,12 @@ export function createForceGraph({ stage, model, onCenterTap, onNodeTap, onNodeL
|
|||||||
parts.push(...directedFriendEdgePaths(x1, y1, cpx, cpy, x2, y2, relationColor(relationType), opacity * 0.82));
|
parts.push(...directedFriendEdgePaths(x1, y1, cpx, cpy, x2, y2, relationColor(relationType), opacity * 0.82));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
let edgeStroke = relationColor(relationType);
|
||||||
|
if (reverseRelationType && reverseRelationType !== relationType) {
|
||||||
|
const gradientId = `fg-relation-gradient-${gradientIndex++}`;
|
||||||
|
defs.push(`<linearGradient id="${gradientId}" x1="0%" y1="0%" x2="100%" y2="0%"><stop offset="0%" stop-color="${relationColor(relationType)}"/><stop offset="100%" stop-color="${relationColor(reverseRelationType)}"/></linearGradient>`);
|
||||||
|
edgeStroke = `url(#${gradientId})`;
|
||||||
|
}
|
||||||
if (shine) {
|
if (shine) {
|
||||||
const pnx = -uy;
|
const pnx = -uy;
|
||||||
const pny = ux;
|
const pny = ux;
|
||||||
@@ -1038,14 +1047,14 @@ export function createForceGraph({ stage, model, onCenterTap, onNodeTap, onNodeL
|
|||||||
parts.push(`<path class="fg-plasma-core" d="${d}" opacity="${opacity.toFixed(3)}" />`);
|
parts.push(`<path class="fg-plasma-core" d="${d}" opacity="${opacity.toFixed(3)}" />`);
|
||||||
} else {
|
} else {
|
||||||
const d = `M${x1.toFixed(1)} ${y1.toFixed(1)} Q${cpx.toFixed(1)} ${cpy.toFixed(1)} ${x2.toFixed(1)} ${y2.toFixed(1)}`;
|
const d = `M${x1.toFixed(1)} ${y1.toFixed(1)} Q${cpx.toFixed(1)} ${cpy.toFixed(1)} ${x2.toFixed(1)} ${y2.toFixed(1)}`;
|
||||||
const col = relationColor(relationType);
|
const col = edgeStroke;
|
||||||
const haloWidth = (2.6 + strength * 1.4).toFixed(2);
|
const haloWidth = (2.6 + strength * 1.4).toFixed(2);
|
||||||
parts.push(`<path d="${d}" fill="none" stroke="${col}" stroke-width="${haloWidth}" stroke-linecap="round" opacity="${(0.22 * opacity).toFixed(2)}" />`);
|
parts.push(`<path d="${d}" fill="none" stroke="${col}" stroke-width="${haloWidth}" stroke-linecap="round" opacity="${(0.22 * opacity).toFixed(2)}" />`);
|
||||||
parts.push(`<path d="${d}" fill="none" stroke="${col}" stroke-width="1.2" stroke-linecap="round" opacity="${(0.70 * opacity).toFixed(2)}" />`);
|
parts.push(`<path d="${d}" fill="none" stroke="${col}" stroke-width="1.2" stroke-linecap="round" opacity="${(0.70 * opacity).toFixed(2)}" />`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
edgesSvg.innerHTML = parts.join('');
|
edgesSvg.innerHTML = `<defs>${defs.join('')}</defs>${parts.join('')}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderEdges() {
|
function renderEdges() {
|
||||||
|
|||||||
@@ -421,6 +421,12 @@
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fg-filter-bar > button {
|
||||||
|
pointer-events: auto;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Стеклянные табы — тонкие пластины матового стекла (frosted glass) */
|
/* Стеклянные табы — тонкие пластины матового стекла (frosted glass) */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -111,3 +111,13 @@ test('V3: регистр логина для запросов, обновлен
|
|||||||
assert.equal(g.snapshot('Alice').nodes.find((n) => n.id === 'bobuser').shining, false);
|
assert.equal(g.snapshot('Alice').nodes.find((n) => n.id === 'bobuser').shining, false);
|
||||||
assert.equal(g.snapshot('Alice').nodes.some((n) => n.id === 'carol'), false);
|
assert.equal(g.snapshot('Alice').nodes.some((n) => n.id === 'carol'), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('V3: взаимная связь сохраняет оба типа для красно-синего перехода', () => {
|
||||||
|
const g = createExplorerGraph();
|
||||||
|
g.add(friends('a', ['b']));
|
||||||
|
g.add(friends('b', [], ['a']));
|
||||||
|
const edge = find(g.snapshot('a', { depth: 0 }), 'b').edgeParents[0];
|
||||||
|
assert.equal(edge.relationType, 'friend');
|
||||||
|
assert.equal(edge.reverseRelationType, 'close_friend');
|
||||||
|
assert.equal(edge.mutual, true);
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user