Поправил пуши для личных сообщений

This commit is contained in:
AidarKC
2026-10-21 11:47:27 +03:00
parent aa5addb5d9
commit 7a6ab3b35a
22 changed files with 723 additions and 678 deletions
@@ -716,6 +716,7 @@ export function createForceGraph({ stage, model, onCenterTap, onNodeTap, onNodeL
node.dotOnly = spec.dotOnly;
node.strength = strength;
node.relationType = src.relationType;
node.mutual = src.mutual !== false;
node.shining = Boolean(src.shining);
node.official = Boolean(src.official);
node.isHistoryCenter = Boolean(src.isHistoryCenter);
@@ -940,6 +941,28 @@ export function createForceGraph({ stage, model, onCenterTap, onNodeTap, onNodeL
n.dotRadius = full ? 12 : 5; // радиус для расчёта концов линий связей
}
// Четыре части одной дуги: толстый штрих → короткий штрих → точечки у адресата.
// Используется и обычным force-графом, и историей / «друзьями друзей».
function directedFriendEdgePaths(x1, y1, cx, cy, x2, y2, color, opacity, width = 1.2) {
const at = (t) => ({
x: (1 - t) ** 2 * x1 + 2 * t * (1 - t) * cx + t ** 2 * x2,
y: (1 - t) ** 2 * y1 + 2 * t * (1 - t) * cy + t ** 2 * y2,
});
const sections = [[20, 3], [12, 4], [6, 4], [1, 5]];
return sections.map(([dash, gap], index) => {
const start = index / sections.length;
const finish = (index + 1) / sections.length;
const a = at(start);
const b = at(finish);
const control = {
x: a.x + (finish - start) * ((1 - start) * (cx - x1) + start * (x2 - cx)),
y: a.y + (finish - start) * ((1 - start) * (cy - y1) + start * (y2 - cy)),
};
const d = `M${a.x.toFixed(1)} ${a.y.toFixed(1)} Q${control.x.toFixed(1)} ${control.y.toFixed(1)} ${b.x.toFixed(1)} ${b.y.toFixed(1)}`;
return `<path d="${d}" fill="none" stroke="${color}" stroke-width="${width}" stroke-linecap="round" stroke-dasharray="${dash} ${gap}" opacity="${opacity.toFixed(3)}" />`;
});
}
function renderHistoryEdges() {
const Z = zoom;
const parts = [];
@@ -990,6 +1013,10 @@ export function createForceGraph({ stage, model, onCenterTap, onNodeTap, onNodeL
const opacity = Math.min(childOpacity, parentOpacity);
const shine = Boolean(parent.shining && n.shining) && !n.hidden;
if (ref?.mutual === false) {
parts.push(...directedFriendEdgePaths(x1, y1, cpx, cpy, x2, y2, relationColor(relationType), opacity * 0.82));
continue;
}
if (shine) {
const pnx = -uy;
const pny = ux;
@@ -1112,6 +1139,11 @@ export function createForceGraph({ stage, model, onCenterTap, onNodeTap, onNodeL
dashAttr = ` stroke-dasharray="${L.toFixed(1)}" stroke-dashoffset="${(L * (1 - growP)).toFixed(1)}"`;
}
const pe = n.alwaysVisible ? 1 : (parent.expandP || 0); // X2 виден сразу; старые deep-ветки — по раскрытию
if (n.mutual === false) {
const opacity = nodeOpacity * sp * (n.tier > 1 ? pe : 1) * 0.82;
if (opacity > 0.02) parts.push(...directedFriendEdgePaths(x1, y1, cpx, cpy, x2, y2, relationColor(n.relationType), opacity));
continue;
}
if (n.tier >= 3) {
// 3-й уровень: тонкая нить В ЦВЕТЕ СВЯЗИ (видна при раскрытии). Сияющая — светится (ореол+ядро).
if (pe > 0.02) {