dishui 0.0.62 → 0.0.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Badge/index.js +12 -9
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/Button/index.js +43 -40
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Card/index.d.ts +11 -0
- package/dist/components/Card/index.js +62 -37
- package/dist/components/Card/index.js.map +1 -1
- package/dist/components/Chart/Chart.js.map +1 -1
- package/dist/components/Checkbox/index.js +32 -30
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Demo/index.js.map +1 -1
- package/dist/components/EmptyState/index.d.ts +4 -1
- package/dist/components/EmptyState/index.js +3 -3
- package/dist/components/EmptyState/index.js.map +1 -1
- package/dist/components/FileUploader/DropZone.js.map +1 -1
- package/dist/components/FileUploader/FileItem.js.map +1 -1
- package/dist/components/FileUploader/FileUploader.js.map +1 -1
- package/dist/components/FileUploader/UploadQueue.js.map +1 -1
- package/dist/components/Input/index.js +30 -30
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/Label/index.js +41 -40
- package/dist/components/Label/index.js.map +1 -1
- package/dist/components/List/index.js +47 -32
- package/dist/components/List/index.js.map +1 -1
- package/dist/components/Markdown/Markdown.js +61 -57
- package/dist/components/Markdown/Markdown.js.map +1 -1
- package/dist/components/Markdown/markdownComponents.js +49 -49
- package/dist/components/Markdown/markdownComponents.js.map +1 -1
- package/dist/components/Modal/index.d.ts +7 -3
- package/dist/components/Modal/index.js +77 -65
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Page/index.d.ts +58 -0
- package/dist/components/Page/index.js +74 -0
- package/dist/components/Page/index.js.map +1 -0
- package/dist/components/PageHeader/index.js.map +1 -1
- package/dist/components/Select/index.js +0 -3
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/SidebarToggleButton/index.js.map +1 -1
- package/dist/components/StatCard/index.d.ts +3 -1
- package/dist/components/StatCard/index.js +39 -11
- package/dist/components/StatCard/index.js.map +1 -1
- package/dist/components/Table/index.js +103 -85
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +19 -5
- package/dist/components/Tabs/index.js +32 -13
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tree/Tree.js.map +1 -1
- package/dist/components/pro/ArticleContextMenu/index.js.map +1 -1
- package/dist/components/pro/ArticleControl/ArticleControl2.js.map +1 -1
- package/dist/components/pro/CodeEditor/editors/CodeEditor.js +141 -134
- package/dist/components/pro/CodeEditor/editors/CodeEditor.js.map +1 -1
- package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js +81 -78
- package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/FootnotePanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/HistoryPanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/OutlinePanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/TableOfContentsPanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/VariablePanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/themes.js +59 -59
- package/dist/components/pro/CodeEditor/themes.js.map +1 -1
- package/dist/components/pro/DataTable/DataTable.js +49 -48
- package/dist/components/pro/DataTable/DataTable.js.map +1 -1
- package/dist/components/pro/DataTable/Filters.js +42 -42
- package/dist/components/pro/DataTable/Filters.js.map +1 -1
- package/dist/components/pro/DataTable/PivotPanel.js.map +1 -1
- package/dist/components/pro/DataTable/PivotView.js +35 -32
- package/dist/components/pro/DataTable/PivotView.js.map +1 -1
- package/dist/components/pro/DataTable/components/BulkActions.js.map +1 -1
- package/dist/components/pro/DataTable/components/ColumnSelector.js.map +1 -1
- package/dist/components/pro/DataTable/components/FilterBar.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableBody.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableHeader.js.map +1 -1
- package/dist/components/pro/DataTable/components/TablePagination.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableToolbar.js.map +1 -1
- package/dist/components/pro/DataTable/pivotExtension.js.map +1 -1
- package/dist/components/pro/DataTable/rowDetailExtension.js.map +1 -1
- package/dist/components/pro/DataTable/tanstack-table.js +37 -37
- package/dist/components/pro/DataTable/tanstack-table.js.map +1 -1
- package/dist/components/pro/FileExplorer/Breadcrumb.js +53 -53
- package/dist/components/pro/FileExplorer/Breadcrumb.js.map +1 -1
- package/dist/components/pro/FileExplorer/CreateDialog.js.map +1 -1
- package/dist/components/pro/FileExplorer/FileExplorer.js.map +1 -1
- package/dist/components/pro/FileExplorer/FileIcon.js +22 -22
- package/dist/components/pro/FileExplorer/FileIcon.js.map +1 -1
- package/dist/components/pro/FileExplorer/GridView.js.map +1 -1
- package/dist/components/pro/FileExplorer/ListView.js.map +1 -1
- package/dist/components/pro/FileExplorer/Toolbar.js.map +1 -1
- package/dist/components/pro/Flow/Flow.js +496 -494
- package/dist/components/pro/Flow/Flow.js.map +1 -1
- package/dist/components/pro/Flow/FlowCanvas.js +916 -917
- package/dist/components/pro/Flow/FlowCanvas.js.map +1 -1
- package/dist/components/pro/Flow/context/FlowUIContext.js.map +1 -1
- package/dist/components/pro/Flow/edges/EdgeRenderer.js +59 -59
- package/dist/components/pro/Flow/edges/EdgeRenderer.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useClipboard.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useDeleteSelection.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useEdgeMutations.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useLayoutActions.js +9 -11
- package/dist/components/pro/Flow/hooks/useLayoutActions.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useLineMutations.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useMindMap.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useNodeMutations.js.map +1 -1
- package/dist/components/pro/Flow/lines/FreehandTool.js +9 -9
- package/dist/components/pro/Flow/lines/FreehandTool.js.map +1 -1
- package/dist/components/pro/Flow/lines/LineRenderer.js +5 -5
- package/dist/components/pro/Flow/lines/LineRenderer.js.map +1 -1
- package/dist/components/pro/Flow/nodes/DataNodeView.js +113 -93
- package/dist/components/pro/Flow/nodes/DataNodeView.js.map +1 -1
- package/dist/components/pro/Flow/nodes/MediaContent.js.map +1 -1
- package/dist/components/pro/Flow/nodes/MediaOverlay.js.map +1 -1
- package/dist/components/pro/Flow/nodes/Model3DView.js +1 -1
- package/dist/components/pro/Flow/nodes/Model3DView.js.map +1 -1
- package/dist/components/pro/Flow/nodes/NodeRenderer.js +118 -118
- package/dist/components/pro/Flow/nodes/NodeRenderer.js.map +1 -1
- package/dist/components/pro/Flow/nodes/dataUtils.js.map +1 -1
- package/dist/components/pro/Flow/nodes/shapes.js +1 -3
- package/dist/components/pro/Flow/nodes/shapes.js.map +1 -1
- package/dist/components/pro/Flow/panels/AIPanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/Breadcrumb.js.map +1 -1
- package/dist/components/pro/Flow/panels/ContextMenu.js.map +1 -1
- package/dist/components/pro/Flow/panels/DataInspectorSection.js.map +1 -1
- package/dist/components/pro/Flow/panels/ExpandableTextarea.js.map +1 -1
- package/dist/components/pro/Flow/panels/FlowPanelGroup.js.map +1 -1
- package/dist/components/pro/Flow/panels/FlowToolbar.js +79 -79
- package/dist/components/pro/Flow/panels/FlowToolbar.js.map +1 -1
- package/dist/components/pro/Flow/panels/InspectorPanel.js +57 -57
- package/dist/components/pro/Flow/panels/InspectorPanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/OutlinePanel.js +26 -22
- package/dist/components/pro/Flow/panels/OutlinePanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/PresentationMode.js +18 -16
- package/dist/components/pro/Flow/panels/PresentationMode.js.map +1 -1
- package/dist/components/pro/Flow/panels/ProjectTitle.js.map +1 -1
- package/dist/components/pro/Flow/panels/ShapePalette.js +109 -104
- package/dist/components/pro/Flow/panels/ShapePalette.js.map +1 -1
- package/dist/components/pro/Flow/panels/toolbarIcons.js.map +1 -1
- package/dist/components/pro/RichTextEditor/AIRewrite.js.map +1 -1
- package/dist/components/pro/RichTextEditor/BlockHandle.js.map +1 -1
- package/dist/components/pro/RichTextEditor/BubbleToolbar.js.map +1 -1
- package/dist/components/pro/RichTextEditor/CommentDialog.js.map +1 -1
- package/dist/components/pro/RichTextEditor/CommentPanel.js.map +1 -1
- package/dist/components/pro/RichTextEditor/CommentPopover.js.map +1 -1
- package/dist/components/pro/RichTextEditor/ContextMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/RichTextEditor.js.map +1 -1
- package/dist/components/pro/RichTextEditor/SlashMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/SelectDropdown.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/TableOpsMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/FloatingDialog.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.js.map +1 -1
- package/dist/contexts/AppContext.js.map +1 -1
- package/dist/dishui.css +1 -1
- package/dist/hooks/useTableColumns.js +7 -8
- package/dist/hooks/useTableColumns.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +227 -221
- package/dist/layouts/MainLayout.js +22 -22
- package/dist/layouts/MainLayout.js.map +1 -1
- package/dist/layouts/Navbar.js.map +1 -1
- package/dist/layouts/Sidebar.js +94 -73
- package/dist/layouts/Sidebar.js.map +1 -1
- package/dist/layouts/headbar/Headbar.js.map +1 -1
- package/dist/layouts/headbar/HeadbarLangSwitcher.js.map +1 -1
- package/dist/layouts/headbar/HeadbarSearch.js.map +1 -1
- package/dist/layouts/headbar/HeadbarThemeSwitcher.js +11 -11
- package/dist/layouts/headbar/HeadbarThemeSwitcher.js.map +1 -1
- package/dist/layouts/headbar/HeadbarTitle.js.map +1 -1
- package/dist/utils/i18n.js +10 -10
- package/dist/utils/i18n.js.map +1 -1
- package/dist/utils/menu.js.map +1 -1
- package/dist/utils/routerBuilder.js +17 -15
- package/dist/utils/routerBuilder.js.map +1 -1
- package/dist/utils/themes.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,460 +1,460 @@
|
|
|
1
|
-
import { useFlowContext as
|
|
2
|
-
import { useFlowUI as
|
|
3
|
-
import { usePixiApp as
|
|
4
|
-
import { useViewport as
|
|
5
|
-
import { GridRenderer as
|
|
6
|
-
import { SelectionOverlay as
|
|
7
|
-
import { shapeDrawers as
|
|
8
|
-
import { findClosestHandleWorld as
|
|
9
|
-
import { distToSegment as
|
|
10
|
-
import { NodeRenderer as
|
|
11
|
-
import { buildEdgePath as
|
|
12
|
-
import { EdgeRenderer as
|
|
13
|
-
import { LineRenderer as
|
|
14
|
-
import { FreehandTool as
|
|
15
|
-
import { GeometricLineTool as
|
|
16
|
-
import { computeAlignmentSnap as
|
|
17
|
-
import { AlignmentGuidesRenderer as
|
|
18
|
-
import { getDocumentSlides as
|
|
19
|
-
import { useDeleteSelection as
|
|
20
|
-
import { useCallback as
|
|
21
|
-
import { jsx as
|
|
22
|
-
import { Graphics as
|
|
23
|
-
var
|
|
1
|
+
import { useFlowContext as Sn } from "./context/FlowContext.js";
|
|
2
|
+
import { useFlowUI as zn } from "./context/FlowUIContext.js";
|
|
3
|
+
import { usePixiApp as Cn } from "./hooks/usePixiApp.js";
|
|
4
|
+
import { useViewport as En } from "./hooks/useViewport.js";
|
|
5
|
+
import { GridRenderer as Nn } from "./canvas/GridRenderer.js";
|
|
6
|
+
import { SelectionOverlay as Tn } from "./canvas/SelectionOverlay.js";
|
|
7
|
+
import { shapeDrawers as ln } from "./nodes/shapes.js";
|
|
8
|
+
import { findClosestHandleWorld as Ft, getHandlePositions as Mt, handleWorldPos as Bt } from "./nodes/NodeHandles.js";
|
|
9
|
+
import { distToSegment as Ge, generateId as kn, isPointInNode as Vt, rectsOverlap as Dn } from "./nodes/nodeUtils.js";
|
|
10
|
+
import { NodeRenderer as Hn } from "./nodes/NodeRenderer.js";
|
|
11
|
+
import { buildEdgePath as mn, linearizeSegments as vn, resolveEdgeEndpoints as St } from "./edges/edgePaths.js";
|
|
12
|
+
import { EdgeRenderer as Pn } from "./edges/EdgeRenderer.js";
|
|
13
|
+
import { LineRenderer as An } from "./lines/LineRenderer.js";
|
|
14
|
+
import { FreehandTool as Ln } from "./lines/FreehandTool.js";
|
|
15
|
+
import { GeometricLineTool as Gn } from "./lines/GeometricLineTool.js";
|
|
16
|
+
import { computeAlignmentSnap as ve } from "./hooks/useAlignmentGuides.js";
|
|
17
|
+
import { AlignmentGuidesRenderer as Wn } from "./canvas/AlignmentGuides.js";
|
|
18
|
+
import { getDocumentSlides as Yn, nextAnimIndex as Xn } from "./nodes/animAnchors.js";
|
|
19
|
+
import { useDeleteSelection as _n } from "./hooks/useDeleteSelection.js";
|
|
20
|
+
import { useCallback as ae, useEffect as Rt, useRef as v, useState as un } from "react";
|
|
21
|
+
import { jsx as qt, jsxs as Ie } from "react/jsx-runtime";
|
|
22
|
+
import { Graphics as le } from "pixi.js";
|
|
23
|
+
var On = {
|
|
24
24
|
nw: "nwse-resize",
|
|
25
25
|
ne: "nesw-resize",
|
|
26
26
|
se: "nwse-resize",
|
|
27
27
|
sw: "nesw-resize"
|
|
28
|
-
},
|
|
29
|
-
function Q(
|
|
30
|
-
return Math.min(
|
|
28
|
+
}, ue = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(pointer: coarse)").matches, fn = ue ? 2 : 1;
|
|
29
|
+
function Q(A, R, D) {
|
|
30
|
+
return Math.min(R * fn / A, D * fn);
|
|
31
31
|
}
|
|
32
|
-
var
|
|
33
|
-
function
|
|
32
|
+
var In = 26;
|
|
33
|
+
function hn(A, R) {
|
|
34
34
|
return {
|
|
35
|
-
x:
|
|
36
|
-
y:
|
|
35
|
+
x: A.position.x + A.width / 2,
|
|
36
|
+
y: A.position.y - In / R
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
return !
|
|
39
|
+
function Zt(A, R, D) {
|
|
40
|
+
return !D || !(R > 0) ? A : Math.round(A / R) * R;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
const { x: U, y:
|
|
42
|
+
function yn(A, R, D) {
|
|
43
|
+
const { x: U, y: P } = R.position, L = R.width, Y = R.height, T = [
|
|
44
44
|
[
|
|
45
45
|
"nw",
|
|
46
46
|
U,
|
|
47
|
-
|
|
47
|
+
P
|
|
48
48
|
],
|
|
49
49
|
[
|
|
50
50
|
"ne",
|
|
51
|
-
U +
|
|
52
|
-
|
|
51
|
+
U + L,
|
|
52
|
+
P
|
|
53
53
|
],
|
|
54
54
|
[
|
|
55
55
|
"se",
|
|
56
|
-
U +
|
|
57
|
-
|
|
56
|
+
U + L,
|
|
57
|
+
P + Y
|
|
58
58
|
],
|
|
59
59
|
[
|
|
60
60
|
"sw",
|
|
61
61
|
U,
|
|
62
|
-
|
|
62
|
+
P + Y
|
|
63
63
|
]
|
|
64
64
|
];
|
|
65
|
-
let
|
|
66
|
-
for (const [j,
|
|
67
|
-
const $ = Math.hypot(
|
|
68
|
-
$ <
|
|
65
|
+
let M = null, B = D;
|
|
66
|
+
for (const [j, ut, ot] of T) {
|
|
67
|
+
const $ = Math.hypot(A.x - ut, A.y - ot);
|
|
68
|
+
$ < B && (B = $, M = j);
|
|
69
69
|
}
|
|
70
|
-
return
|
|
70
|
+
return M;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
let
|
|
74
|
-
for (const
|
|
75
|
-
const
|
|
76
|
-
if (!
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
edgeId:
|
|
72
|
+
function pn(A, R, D, U, P) {
|
|
73
|
+
let L = null, Y = P;
|
|
74
|
+
for (const T of D) {
|
|
75
|
+
const M = St(T, U);
|
|
76
|
+
if (!M) continue;
|
|
77
|
+
const B = Math.hypot(A - M.sx, R - M.sy);
|
|
78
|
+
B < Y && (Y = B, L = {
|
|
79
|
+
edgeId: T.id,
|
|
80
80
|
end: "source",
|
|
81
|
-
worldX:
|
|
82
|
-
worldY:
|
|
81
|
+
worldX: M.sx,
|
|
82
|
+
worldY: M.sy
|
|
83
83
|
});
|
|
84
|
-
const j = Math.hypot(
|
|
85
|
-
j <
|
|
86
|
-
edgeId:
|
|
84
|
+
const j = Math.hypot(A - M.tx, R - M.ty);
|
|
85
|
+
j < Y && (Y = j, L = {
|
|
86
|
+
edgeId: T.id,
|
|
87
87
|
end: "target",
|
|
88
|
-
worldX:
|
|
89
|
-
worldY:
|
|
88
|
+
worldX: M.tx,
|
|
89
|
+
worldY: M.ty
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
-
return
|
|
92
|
+
return L;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
let
|
|
96
|
-
for (const
|
|
97
|
-
const
|
|
98
|
-
if (
|
|
99
|
-
for (let
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
edgeId:
|
|
103
|
-
waypointIndex:
|
|
104
|
-
wx:
|
|
105
|
-
wy:
|
|
94
|
+
function xn(A, R, D, U) {
|
|
95
|
+
let P = null, L = U;
|
|
96
|
+
for (const Y of D) {
|
|
97
|
+
const T = Y.data.waypoints;
|
|
98
|
+
if (T)
|
|
99
|
+
for (let M = 0; M < T.length; M++) {
|
|
100
|
+
const B = Math.hypot(A - T[M].x, R - T[M].y);
|
|
101
|
+
B < L && (L = B, P = {
|
|
102
|
+
edgeId: Y.id,
|
|
103
|
+
waypointIndex: M,
|
|
104
|
+
wx: T[M].x,
|
|
105
|
+
wy: T[M].y
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
return
|
|
109
|
+
return P;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
let
|
|
113
|
-
for (const
|
|
114
|
-
if (
|
|
115
|
-
const
|
|
116
|
-
if (!
|
|
117
|
-
const
|
|
111
|
+
function gn(A, R, D, U, P) {
|
|
112
|
+
let L = null, Y = P;
|
|
113
|
+
for (const T of D) {
|
|
114
|
+
if (T.type !== "simplebezier") continue;
|
|
115
|
+
const M = St(T, U);
|
|
116
|
+
if (!M) continue;
|
|
117
|
+
const B = T.data.waypoints ?? [], j = [
|
|
118
118
|
{
|
|
119
|
-
x:
|
|
120
|
-
y:
|
|
119
|
+
x: M.sx,
|
|
120
|
+
y: M.sy
|
|
121
121
|
},
|
|
122
|
-
...
|
|
122
|
+
...B,
|
|
123
123
|
{
|
|
124
|
-
x:
|
|
125
|
-
y:
|
|
124
|
+
x: M.tx,
|
|
125
|
+
y: M.ty
|
|
126
126
|
}
|
|
127
|
-
],
|
|
128
|
-
for (let $ = 0; $ <=
|
|
129
|
-
const
|
|
130
|
-
Ct <
|
|
131
|
-
edgeId:
|
|
127
|
+
], ut = T.data.bezierControls, ot = j.length - 2;
|
|
128
|
+
for (let $ = 0; $ <= ot; $++) {
|
|
129
|
+
const et = j[$], st = j[$ + 1], zt = ut?.[$], fe = Math.hypot(st.x - et.x, st.y - et.y), wt = Math.max(30, fe * 0.3), he = zt?.c1x ?? ($ === 0 ? et.x + M.snx * wt : et.x + (st.x - et.x) * 0.4), ye = zt?.c1y ?? ($ === 0 ? et.y + M.sny * wt : et.y), Kt = zt?.c2x ?? ($ === ot ? st.x + M.tnx * wt : st.x - (st.x - et.x) * 0.4), Ut = zt?.c2y ?? ($ === ot ? st.y + M.tny * wt : st.y), Ct = Math.hypot(A - he, R - ye);
|
|
130
|
+
Ct < Y && (Y = Ct, L = {
|
|
131
|
+
edgeId: T.id,
|
|
132
132
|
segmentIndex: $,
|
|
133
133
|
controlEnd: "c1",
|
|
134
134
|
wx: he,
|
|
135
|
-
wy:
|
|
135
|
+
wy: ye
|
|
136
136
|
});
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
edgeId:
|
|
137
|
+
const Et = Math.hypot(A - Kt, R - Ut);
|
|
138
|
+
Et < Y && (Y = Et, L = {
|
|
139
|
+
edgeId: T.id,
|
|
140
140
|
segmentIndex: $,
|
|
141
141
|
controlEnd: "c2",
|
|
142
|
-
wx:
|
|
143
|
-
wy:
|
|
142
|
+
wx: Kt,
|
|
143
|
+
wy: Ut
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
return
|
|
147
|
+
return L;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
const
|
|
151
|
-
if (!
|
|
152
|
-
const
|
|
149
|
+
function Fn(A, R, D, U) {
|
|
150
|
+
const P = St(D, U);
|
|
151
|
+
if (!P) return 0;
|
|
152
|
+
const L = D.data.waypoints ?? [], Y = [
|
|
153
153
|
{
|
|
154
|
-
x:
|
|
155
|
-
y:
|
|
154
|
+
x: P.sx,
|
|
155
|
+
y: P.sy
|
|
156
156
|
},
|
|
157
|
-
...
|
|
157
|
+
...L,
|
|
158
158
|
{
|
|
159
|
-
x:
|
|
160
|
-
y:
|
|
159
|
+
x: P.tx,
|
|
160
|
+
y: P.ty
|
|
161
161
|
}
|
|
162
162
|
];
|
|
163
|
-
let
|
|
164
|
-
for (let
|
|
165
|
-
const j =
|
|
166
|
-
j <
|
|
163
|
+
let T = 1 / 0, M = 0;
|
|
164
|
+
for (let B = 0; B < Y.length - 1; B++) {
|
|
165
|
+
const j = Ge(A, R, Y[B].x, Y[B].y, Y[B + 1].x, Y[B + 1].y);
|
|
166
|
+
j < T && (T = j, M = B);
|
|
167
167
|
}
|
|
168
|
-
return
|
|
168
|
+
return M;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
let { x:
|
|
172
|
-
const
|
|
173
|
-
return
|
|
174
|
-
x:
|
|
175
|
-
y:
|
|
176
|
-
w:
|
|
177
|
-
h:
|
|
170
|
+
function Bn(A, R, D, U, P = 24) {
|
|
171
|
+
let { x: L, y: Y, w: T, h: M } = { ...A };
|
|
172
|
+
const B = R === "nw" || R === "sw", j = R === "ne" || R === "se", ut = R === "nw" || R === "ne", ot = R === "sw" || R === "se";
|
|
173
|
+
return B && (L += D, T -= D), j && (T += D), ut && (Y += U, M -= U), ot && (M += U), T < P && (B && (L = A.x + A.w - P), T = P), M < P && (ut && (Y = A.y + A.h - P), M = P), {
|
|
174
|
+
x: L,
|
|
175
|
+
y: Y,
|
|
176
|
+
w: T,
|
|
177
|
+
h: M
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
|
-
function
|
|
181
|
-
const
|
|
182
|
-
if (!
|
|
183
|
-
const
|
|
184
|
-
for (let
|
|
180
|
+
function Le(A, R, D, U, P) {
|
|
181
|
+
const L = St(D, U);
|
|
182
|
+
if (!L) return !1;
|
|
183
|
+
const Y = mn(D.type, L, D.data.waypoints, D.data.bezierControls), T = vn(Y);
|
|
184
|
+
for (let M = 0; M < T.length - 1; M++) if (Ge(A, R, T[M].x, T[M].y, T[M + 1].x, T[M + 1].y) < P) return !0;
|
|
185
185
|
return !1;
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
const
|
|
189
|
-
for (let
|
|
187
|
+
function wn(A, R, D, U) {
|
|
188
|
+
const P = D.points;
|
|
189
|
+
for (let L = 0; L < P.length - 1; L++) if (Ge(A, R, P[L].x, P[L].y, P[L + 1].x, P[L + 1].y) < U) return !0;
|
|
190
190
|
return !1;
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
const
|
|
194
|
-
U.current = f.gridDot,
|
|
195
|
-
}, [])), { setViewportInternal:
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
const Nt =
|
|
202
|
-
Nt.current =
|
|
203
|
-
const
|
|
192
|
+
function yr({ onPixiReady: A }) {
|
|
193
|
+
const R = v(null), D = v(null), U = v(13751771), P = ae((f) => {
|
|
194
|
+
U.current = f.gridDot, D.current && (D.current.dotColor = f.gridDot);
|
|
195
|
+
}, []), { pixiRef: L, readyRef: Y } = Cn(R, P), { setViewportInternal: T, viewportReqRef: M, viewport: B, autoFocus: j, showGrid: ut, showAnchors: ot, gridSize: $, toolMode: et, edgeType: st, focusOnRect: zt, setFocusOnRect: fe, pendingPlacement: wt, setPendingPlacement: he, setContextMenu: ye, beginNodeDrag: Kt, endNodeDrag: Ut, presentation: Ct, editingNodeId: Et, setEditingNodeId: $t, readOnly: We, placementSnap: Ye } = zn(), { currentCanvas: be, selection: Xe, setSelection: xt, setDoc: tt, currentCanvasId: Me, pushCanvas: bn, doc: _e } = Sn(), Oe = _n(), Fe = v(Oe);
|
|
196
|
+
Fe.current = Oe;
|
|
197
|
+
const Be = v(null), jt = v(We);
|
|
198
|
+
jt.current = We;
|
|
199
|
+
const Jt = v(Ye);
|
|
200
|
+
Jt.current = Ye;
|
|
201
|
+
const Nt = v($);
|
|
202
|
+
Nt.current = $;
|
|
203
|
+
const Tt = v(null), pe = v(null), xe = v(null), ge = v(null), Re = v(null), Se = v(null), kt = v(null), Qt = v(null), te = v(null), we = v(null), Lt = v([]), Gt = v(null), Wt = v(null), ft = v(null), ee = v(null), Ve = v({
|
|
204
204
|
time: 0,
|
|
205
205
|
wx: 0,
|
|
206
206
|
wy: 0
|
|
207
|
-
}),
|
|
207
|
+
}), Yt = v({
|
|
208
208
|
time: 0,
|
|
209
209
|
wx: 0,
|
|
210
210
|
wy: 0
|
|
211
|
-
}),
|
|
211
|
+
}), qe = v(0), ne = v(null), Ze = v({
|
|
212
212
|
x: 0,
|
|
213
213
|
y: 0
|
|
214
|
-
}),
|
|
215
|
-
...
|
|
216
|
-
nodes:
|
|
217
|
-
}, X =
|
|
218
|
-
X.current =
|
|
219
|
-
const Z =
|
|
220
|
-
Z.current =
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
const ce =
|
|
230
|
-
ce.current =
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
const Dt =
|
|
236
|
-
Dt.current =
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
const Ht =
|
|
242
|
-
Ht.current =
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
Ee.current = 0,
|
|
214
|
+
}), Ke = ot || Ct ? be : {
|
|
215
|
+
...be,
|
|
216
|
+
nodes: be.nodes.filter((f) => f.type !== "animAnchor")
|
|
217
|
+
}, X = v(Ke);
|
|
218
|
+
X.current = Ke;
|
|
219
|
+
const Z = v(Me);
|
|
220
|
+
Z.current = Me;
|
|
221
|
+
const re = v(Xe);
|
|
222
|
+
re.current = Xe;
|
|
223
|
+
const Ue = v(_e);
|
|
224
|
+
Ue.current = _e;
|
|
225
|
+
const oe = v(et);
|
|
226
|
+
oe.current = et;
|
|
227
|
+
const se = v(j);
|
|
228
|
+
se.current = j;
|
|
229
|
+
const ce = v(zt);
|
|
230
|
+
ce.current = zt;
|
|
231
|
+
const $e = v(st);
|
|
232
|
+
$e.current = st;
|
|
233
|
+
const je = v(ot);
|
|
234
|
+
je.current = ot;
|
|
235
|
+
const Dt = v(Ct);
|
|
236
|
+
Dt.current = Ct;
|
|
237
|
+
const ie = v(wt);
|
|
238
|
+
ie.current = wt;
|
|
239
|
+
const ze = v(Kt);
|
|
240
|
+
ze.current = Kt;
|
|
241
|
+
const Ht = v(Ut);
|
|
242
|
+
Ht.current = Ut;
|
|
243
|
+
const ct = v(null), nt = v(null), rt = v(null), ht = v(null), it = v(null), mt = v(null), gt = v(null), vt = v(null), Ce = v(B), Ee = v(0), Mn = ae((f) => {
|
|
244
|
+
Ce.current = f, Ee.current || (Ee.current = requestAnimationFrame(() => {
|
|
245
|
+
Ee.current = 0, T(Ce.current);
|
|
246
246
|
}));
|
|
247
|
-
}, [
|
|
248
|
-
dt.current =
|
|
249
|
-
const [
|
|
250
|
-
|
|
251
|
-
const
|
|
247
|
+
}, [T]), { vmRef: V, screenToWorld: Je } = En(L, Mn), dt = v(Je);
|
|
248
|
+
dt.current = Je;
|
|
249
|
+
const [yt, Ne] = un(null), [Te, ke] = un(null), De = v(yt);
|
|
250
|
+
De.current = yt;
|
|
251
|
+
const me = v(() => {
|
|
252
252
|
});
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
me.current = (f, G, O) => {
|
|
254
|
+
$t(f === "node" ? G : null), Ne({
|
|
255
255
|
kind: f,
|
|
256
256
|
id: G,
|
|
257
|
-
value:
|
|
257
|
+
value: O
|
|
258
258
|
});
|
|
259
259
|
};
|
|
260
|
-
const
|
|
261
|
-
const G =
|
|
262
|
-
G && (tt((
|
|
263
|
-
const
|
|
264
|
-
if (!K) return
|
|
265
|
-
let
|
|
266
|
-
if (G.kind === "node")
|
|
260
|
+
const Qe = ae((f) => {
|
|
261
|
+
const G = De.current;
|
|
262
|
+
G && (tt((O) => {
|
|
263
|
+
const W = Z.current, K = O.canvases[W];
|
|
264
|
+
if (!K) return O;
|
|
265
|
+
let q = K;
|
|
266
|
+
if (G.kind === "node") q = {
|
|
267
267
|
...K,
|
|
268
|
-
nodes: K.nodes.map((
|
|
269
|
-
...
|
|
268
|
+
nodes: K.nodes.map((F) => F.id === G.id ? {
|
|
269
|
+
...F,
|
|
270
270
|
data: {
|
|
271
|
-
...
|
|
271
|
+
...F.data,
|
|
272
272
|
label: f
|
|
273
273
|
}
|
|
274
|
-
} :
|
|
274
|
+
} : F)
|
|
275
275
|
};
|
|
276
|
-
else if (G.kind === "edge")
|
|
276
|
+
else if (G.kind === "edge") q = {
|
|
277
277
|
...K,
|
|
278
|
-
edges: K.edges.map((
|
|
279
|
-
...
|
|
278
|
+
edges: K.edges.map((F) => F.id === G.id ? {
|
|
279
|
+
...F,
|
|
280
280
|
data: {
|
|
281
|
-
...
|
|
281
|
+
...F.data,
|
|
282
282
|
labelText: f
|
|
283
283
|
}
|
|
284
|
-
} :
|
|
284
|
+
} : F)
|
|
285
285
|
};
|
|
286
|
-
else return
|
|
286
|
+
else return O;
|
|
287
287
|
return {
|
|
288
|
-
...
|
|
288
|
+
...O,
|
|
289
289
|
canvases: {
|
|
290
|
-
...
|
|
291
|
-
[
|
|
290
|
+
...O.canvases,
|
|
291
|
+
[W]: q
|
|
292
292
|
}
|
|
293
293
|
};
|
|
294
|
-
}),
|
|
295
|
-
}, [tt,
|
|
296
|
-
|
|
297
|
-
}, [
|
|
294
|
+
}), Ne(null), $t(null), ke(null));
|
|
295
|
+
}, [tt, $t]), Rn = ae(() => {
|
|
296
|
+
Ne(null), $t(null), ke(null);
|
|
297
|
+
}, [$t]);
|
|
298
298
|
Rt(() => {
|
|
299
|
-
if (!
|
|
300
|
-
const f = X.current.nodes.find((G) => G.id ===
|
|
301
|
-
f &&
|
|
302
|
-
}, [
|
|
303
|
-
if (!
|
|
304
|
-
const f =
|
|
299
|
+
if (!Et || De.current?.id === Et) return;
|
|
300
|
+
const f = X.current.nodes.find((G) => G.id === Et);
|
|
301
|
+
f && me.current("node", f.id, f.data.label);
|
|
302
|
+
}, [Et]), Rt(() => {
|
|
303
|
+
if (!yt) return;
|
|
304
|
+
const f = V.current;
|
|
305
305
|
if (!f) return;
|
|
306
306
|
const G = X.current;
|
|
307
|
-
let
|
|
308
|
-
if (
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
x:
|
|
312
|
-
y:
|
|
307
|
+
let O = null;
|
|
308
|
+
if (yt.kind === "node") {
|
|
309
|
+
const W = G.nodes.find((K) => K.id === yt.id);
|
|
310
|
+
W && (O = {
|
|
311
|
+
x: W.position.x + W.width / 2,
|
|
312
|
+
y: W.position.y + W.height / 2
|
|
313
313
|
});
|
|
314
|
-
} else if (
|
|
315
|
-
const
|
|
316
|
-
for (const
|
|
317
|
-
if (
|
|
318
|
-
const
|
|
319
|
-
if (
|
|
320
|
-
const
|
|
321
|
-
x: (
|
|
322
|
-
y: (
|
|
314
|
+
} else if (yt.kind === "edge") {
|
|
315
|
+
const W = G.edges.find((q) => q.id === yt.id), K = /* @__PURE__ */ new Map();
|
|
316
|
+
for (const q of G.nodes) K.set(q.id, q);
|
|
317
|
+
if (W) {
|
|
318
|
+
const q = St(W, K);
|
|
319
|
+
if (q) {
|
|
320
|
+
const F = mn(W.type, q, W.data.waypoints, W.data.bezierControls), at = vn(F), lt = at[Math.floor(at.length / 2)] ?? {
|
|
321
|
+
x: (q.sx + q.tx) / 2,
|
|
322
|
+
y: (q.sy + q.ty) / 2
|
|
323
323
|
};
|
|
324
|
-
|
|
325
|
-
x:
|
|
326
|
-
y:
|
|
324
|
+
O = {
|
|
325
|
+
x: lt.x,
|
|
326
|
+
y: lt.y
|
|
327
327
|
};
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
-
if (
|
|
332
|
-
const
|
|
331
|
+
if (O) {
|
|
332
|
+
const W = f.worldToScreen(O.x, O.y);
|
|
333
333
|
ke({
|
|
334
|
-
x:
|
|
335
|
-
y:
|
|
334
|
+
x: W.x,
|
|
335
|
+
y: W.y
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
|
-
}, [
|
|
339
|
-
const
|
|
338
|
+
}, [yt, V]);
|
|
339
|
+
const tn = v(0);
|
|
340
340
|
Rt(() => {
|
|
341
|
-
|
|
341
|
+
M.current !== tn.current && (tn.current = M.current, Ce.current = B, V.current?.setState(B));
|
|
342
342
|
}, [
|
|
343
|
-
E,
|
|
344
343
|
B,
|
|
345
|
-
|
|
344
|
+
V,
|
|
345
|
+
M
|
|
346
346
|
]), Rt(() => {
|
|
347
|
-
|
|
348
|
-
const
|
|
349
|
-
if (!
|
|
350
|
-
const at =
|
|
351
|
-
|
|
352
|
-
x:
|
|
353
|
-
y:
|
|
347
|
+
fe((f, G, O, W, K) => {
|
|
348
|
+
const q = V.current, F = R.current;
|
|
349
|
+
if (!q || !F) return;
|
|
350
|
+
const at = F.clientWidth || 800, lt = F.clientHeight || 600, It = Math.max(0, K?.padding ?? 60), Xt = Math.max(1, at - It * 2), bt = Math.max(1, lt - It * 2), Pt = K?.preserveZoom ? q.state.zoom : Math.min(Xt / Math.max(O, 1), bt / Math.max(W, 1), K?.maxZoom ?? 2), At = f + O / 2, pt = G + W / 2, de = at / 2 - At * Pt, Pe = lt / 2 - pt * Pt;
|
|
351
|
+
q.animateTo({
|
|
352
|
+
x: de,
|
|
353
|
+
y: Pe,
|
|
354
354
|
zoom: Pt
|
|
355
355
|
}, K?.duration ?? 350);
|
|
356
356
|
});
|
|
357
|
-
}, [
|
|
358
|
-
const
|
|
357
|
+
}, [fe, V]);
|
|
358
|
+
const en = ae((f) => {
|
|
359
359
|
tt((G) => {
|
|
360
|
-
const
|
|
361
|
-
return
|
|
360
|
+
const O = G.canvases[Z.current];
|
|
361
|
+
return O ? {
|
|
362
362
|
...G,
|
|
363
363
|
canvases: {
|
|
364
364
|
...G.canvases,
|
|
365
365
|
[Z.current]: {
|
|
366
|
-
...
|
|
367
|
-
lines: [...
|
|
366
|
+
...O,
|
|
367
|
+
lines: [...O.lines, f]
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
} : G;
|
|
371
371
|
});
|
|
372
|
-
}, [tt,
|
|
373
|
-
return
|
|
374
|
-
const f =
|
|
372
|
+
}, [tt, Me]), He = v(en);
|
|
373
|
+
return He.current = en, Rt(() => {
|
|
374
|
+
const f = L.current;
|
|
375
375
|
if (!f || f.destroyed) return;
|
|
376
|
-
let G = !1,
|
|
377
|
-
const
|
|
376
|
+
let G = !1, O = null, W = null, K = null;
|
|
377
|
+
const q = () => {
|
|
378
378
|
if (G) return;
|
|
379
|
-
if (!
|
|
380
|
-
setTimeout(
|
|
379
|
+
if (!Y.current) {
|
|
380
|
+
setTimeout(q, 30);
|
|
381
381
|
return;
|
|
382
382
|
}
|
|
383
|
-
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
const at = new
|
|
387
|
-
at.label = "transform-handles", f.app.stage.addChild(at),
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
const It = new
|
|
391
|
-
It.label = "edge-edit-handles", f.world.addChild(It),
|
|
392
|
-
const
|
|
393
|
-
|
|
394
|
-
onLineComplete: (
|
|
395
|
-
screenToWorld: (
|
|
396
|
-
}),
|
|
397
|
-
onLineComplete: (
|
|
398
|
-
screenToWorld: (
|
|
399
|
-
}),
|
|
383
|
+
D.current = new Nn(f.app.stage, $, ut), D.current.dotColor = U.current, Tt.current = new Tn(f.app.stage), pe.current = new Hn(f.world), xe.current = new Pn(f.world), ge.current = new An(f.world);
|
|
384
|
+
const F = new le();
|
|
385
|
+
F.label = "connect-line", F.visible = !1, f.world.addChild(F), mt.current = F;
|
|
386
|
+
const at = new le();
|
|
387
|
+
at.label = "transform-handles", f.app.stage.addChild(at), Qt.current = at;
|
|
388
|
+
const lt = new le();
|
|
389
|
+
lt.label = "handle-hover", f.world.addChild(lt), te.current = lt;
|
|
390
|
+
const It = new le();
|
|
391
|
+
It.label = "edge-edit-handles", f.world.addChild(It), ee.current = It;
|
|
392
|
+
const Xt = new le();
|
|
393
|
+
Xt.label = "ghost-placement", Xt.alpha = 0.5, f.world.addChild(Xt), ne.current = Xt, we.current = new Wn(f.world), Re.current = new Ln(f.app.stage, f.world, {
|
|
394
|
+
onLineComplete: (g) => He.current(g),
|
|
395
|
+
screenToWorld: (g, c) => dt.current(g, c)
|
|
396
|
+
}), Se.current = new Gn(f.app.stage, f.world, {
|
|
397
|
+
onLineComplete: (g) => He.current(g),
|
|
398
|
+
screenToWorld: (g, c) => dt.current(g, c)
|
|
399
|
+
}), A?.(f);
|
|
400
400
|
const bt = f.app.stage;
|
|
401
|
-
bt.on("pointerdown", (
|
|
402
|
-
if (
|
|
403
|
-
const
|
|
404
|
-
if (
|
|
405
|
-
|
|
401
|
+
bt.on("pointerdown", (g) => {
|
|
402
|
+
if (R.current?.focus({ preventScroll: !0 }), V.current?.multiTouchActive || V.current?.isPanning || V.current?.isSpaceHeld || g.button !== 0) return;
|
|
403
|
+
const c = oe.current;
|
|
404
|
+
if (c === "pan") {
|
|
405
|
+
V.current?.startPan(g.global.x, g.global.y);
|
|
406
406
|
return;
|
|
407
407
|
}
|
|
408
|
-
if (
|
|
409
|
-
const
|
|
410
|
-
if (
|
|
411
|
-
const
|
|
412
|
-
if (
|
|
413
|
-
time:
|
|
414
|
-
wx:
|
|
415
|
-
wy:
|
|
416
|
-
},
|
|
417
|
-
const t = p.find((
|
|
408
|
+
if (c === "freehand" || c === "line" || c === "polyline" || c === "arrow") return;
|
|
409
|
+
const i = dt.current(g.global.x, g.global.y), p = X.current.nodes, H = X.current.edges, N = X.current.lines, z = re.current, C = g.metaKey || g.ctrlKey || g.shiftKey, k = V.current?.state.zoom ?? 1;
|
|
410
|
+
if (ie.current) return;
|
|
411
|
+
const o = Date.now(), x = Ve.current, l = o - x.time < 350 && Math.hypot(i.x - x.wx, i.y - x.wy) < 8 / k;
|
|
412
|
+
if (Ve.current = {
|
|
413
|
+
time: o,
|
|
414
|
+
wx: i.x,
|
|
415
|
+
wy: i.y
|
|
416
|
+
}, z.nodeIds.size === 1 && !C && c === "select" && !jt.current) {
|
|
417
|
+
const t = p.find((r) => r.id === [...z.nodeIds][0]);
|
|
418
418
|
if (t) {
|
|
419
|
-
const
|
|
420
|
-
if (Math.hypot(
|
|
421
|
-
|
|
419
|
+
const r = hn(t, k);
|
|
420
|
+
if (Math.hypot(i.x - r.x, i.y - r.y) < Q(k, 12, 24)) {
|
|
421
|
+
ht.current = {
|
|
422
422
|
active: !0,
|
|
423
423
|
nodeId: t.id,
|
|
424
424
|
cx: t.position.x + t.width / 2,
|
|
425
425
|
cy: t.position.y + t.height / 2,
|
|
426
|
-
startPointerAngle: Math.atan2(
|
|
426
|
+
startPointerAngle: Math.atan2(i.y - (t.position.y + t.height / 2), i.x - (t.position.x + t.width / 2)),
|
|
427
427
|
startRotation: t.data.rotation ?? 0
|
|
428
|
-
},
|
|
428
|
+
}, ze.current();
|
|
429
429
|
return;
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
|
-
if (
|
|
434
|
-
const t = p.find((
|
|
433
|
+
if (z.nodeIds.size === 1 && !C && c === "select") {
|
|
434
|
+
const t = p.find((r) => r.id === [...z.nodeIds][0]);
|
|
435
435
|
if (t) {
|
|
436
|
-
const
|
|
437
|
-
if (
|
|
438
|
-
const a = /* @__PURE__ */ new Map(),
|
|
436
|
+
const r = yn(i, t, Q(k, 10, 16));
|
|
437
|
+
if (r) {
|
|
438
|
+
const a = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), n = t.type === "geometryGroup", s = n || t.type === "flowGroup" || t.data.isGroup, m = t.position.x, h = t.position.y, I = t.width, S = t.height;
|
|
439
439
|
for (const u of p)
|
|
440
440
|
u.id !== t.id && (u.parentId === t.id ? a.set(u.id, {
|
|
441
441
|
x: u.position.x,
|
|
442
442
|
y: u.position.y,
|
|
443
443
|
w: u.width,
|
|
444
444
|
h: u.height
|
|
445
|
-
}) : n && u.position.x >=
|
|
445
|
+
}) : n && u.position.x >= m && u.position.y >= h && u.position.x + u.width <= m + I && u.position.y + u.height <= h + S && a.set(u.id, {
|
|
446
446
|
x: u.position.x,
|
|
447
447
|
y: u.position.y,
|
|
448
448
|
w: u.width,
|
|
449
449
|
h: u.height
|
|
450
450
|
}));
|
|
451
|
-
if (
|
|
452
|
-
for (const u of X.current.lines) u.parentId === t.id ?
|
|
453
|
-
|
|
451
|
+
if (s)
|
|
452
|
+
for (const u of X.current.lines) u.parentId === t.id ? d.set(u.id, u.points.map((b) => ({ ...b }))) : n && u.points.length > 0 && u.points.every((b) => b.x >= m && b.x <= m + I && b.y >= h && b.y <= h + S) && d.set(u.id, u.points.map((b) => ({ ...b })));
|
|
453
|
+
gt.current = {
|
|
454
454
|
active: !0,
|
|
455
455
|
nodeId: t.id,
|
|
456
|
-
handle:
|
|
457
|
-
startWorld:
|
|
456
|
+
handle: r,
|
|
457
|
+
startWorld: i,
|
|
458
458
|
startBounds: {
|
|
459
459
|
x: t.position.x,
|
|
460
460
|
y: t.position.y,
|
|
@@ -462,108 +462,108 @@ function fr({ onPixiReady: L }) {
|
|
|
462
462
|
h: t.height
|
|
463
463
|
},
|
|
464
464
|
childStarts: a,
|
|
465
|
-
childLineStarts:
|
|
465
|
+
childLineStarts: d.size > 0 ? d : void 0
|
|
466
466
|
};
|
|
467
467
|
return;
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
471
|
let e = null;
|
|
472
|
-
for (let t = p.length - 1; t >= 0; t--) if (
|
|
472
|
+
for (let t = p.length - 1; t >= 0; t--) if (Vt(i.x, i.y, p[t])) {
|
|
473
473
|
e = p[t];
|
|
474
474
|
break;
|
|
475
475
|
}
|
|
476
476
|
if (e?.parentId) {
|
|
477
|
-
const t = p.find((
|
|
477
|
+
const t = p.find((r) => r.id === e.parentId);
|
|
478
478
|
t && (e = t);
|
|
479
479
|
}
|
|
480
|
-
|
|
481
|
-
let
|
|
482
|
-
if (e &&
|
|
483
|
-
const t = e ? [e] : p,
|
|
484
|
-
let a = null,
|
|
485
|
-
for (const
|
|
486
|
-
const
|
|
487
|
-
if (!
|
|
488
|
-
const
|
|
489
|
-
|
|
480
|
+
ue && (kt.current = e ? e.parentId ? p.find((t) => t.id === e.parentId)?.id ?? e.id : e.id : null, Gt.current = null, Wt.current = null);
|
|
481
|
+
let w = !1;
|
|
482
|
+
if (e && c === "select" && (w = Math.min(i.x - e.position.x, e.position.x + e.width - i.x, i.y - e.position.y, e.position.y + e.height - i.y) > Math.min(14, Math.min(e.width, e.height) * 0.3)), (c === "select" || c === "connect") && (e || ue) && !w) {
|
|
483
|
+
const t = e ? [e] : p, r = Q(k, 14, 20);
|
|
484
|
+
let a = null, d = null, n = 1 / 0;
|
|
485
|
+
for (const s of t) {
|
|
486
|
+
const m = Mt(s.width, s.height), h = Ft(m, s, i.x, i.y, r);
|
|
487
|
+
if (!h) continue;
|
|
488
|
+
const I = Bt(h, s), S = Math.hypot(i.x - I.x, i.y - I.y);
|
|
489
|
+
S < n && (n = S, a = s, d = h);
|
|
490
490
|
}
|
|
491
|
-
if (a &&
|
|
491
|
+
if (a && d) {
|
|
492
492
|
rt.current = {
|
|
493
493
|
active: !0,
|
|
494
494
|
sourceNodeId: a.id,
|
|
495
|
-
sourceHandleId:
|
|
495
|
+
sourceHandleId: d.id
|
|
496
496
|
};
|
|
497
497
|
return;
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
|
-
if ((
|
|
500
|
+
if ((c === "select" || c === "connect") && !C && z.edgeIds.size > 0) {
|
|
501
501
|
const t = /* @__PURE__ */ new Map();
|
|
502
|
-
for (const
|
|
503
|
-
const
|
|
502
|
+
for (const d of p) t.set(d.id, d);
|
|
503
|
+
const r = H.filter((d) => z.edgeIds.has(d.id)), a = pn(i.x, i.y, r, t, Q(k, 14, 20));
|
|
504
504
|
if (a) {
|
|
505
|
-
const
|
|
506
|
-
if (
|
|
505
|
+
const d = H.find((n) => n.id === a.edgeId);
|
|
506
|
+
if (d) {
|
|
507
507
|
const n = a.end === "source" ? "target" : "source";
|
|
508
|
-
|
|
508
|
+
it.current = {
|
|
509
509
|
active: !0,
|
|
510
|
-
edgeId:
|
|
510
|
+
edgeId: d.id,
|
|
511
511
|
movingEnd: a.end,
|
|
512
|
-
fixedNodeId: n === "source" ?
|
|
513
|
-
fixedHandleId: n === "source" ?
|
|
512
|
+
fixedNodeId: n === "source" ? d.source : d.target,
|
|
513
|
+
fixedHandleId: n === "source" ? d.sourceHandle : d.targetHandle
|
|
514
514
|
};
|
|
515
515
|
return;
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
|
-
if (
|
|
519
|
+
if (c === "select" && z.edgeIds.size > 0 && !e) {
|
|
520
520
|
const t = /* @__PURE__ */ new Map();
|
|
521
|
-
for (const
|
|
522
|
-
const
|
|
523
|
-
if (
|
|
524
|
-
|
|
521
|
+
for (const s of p) t.set(s.id, s);
|
|
522
|
+
const r = H.filter((s) => z.edgeIds.has(s.id)), a = Q(k, 10, 14), d = gn(i.x, i.y, r, t, a);
|
|
523
|
+
if (d) {
|
|
524
|
+
ft.current = {
|
|
525
525
|
active: !0,
|
|
526
|
-
edgeId:
|
|
527
|
-
type:
|
|
528
|
-
index:
|
|
526
|
+
edgeId: d.edgeId,
|
|
527
|
+
type: d.controlEnd === "c1" ? "bezierC1" : "bezierC2",
|
|
528
|
+
index: d.segmentIndex
|
|
529
529
|
};
|
|
530
530
|
return;
|
|
531
531
|
}
|
|
532
|
-
const n =
|
|
532
|
+
const n = xn(i.x, i.y, r, a);
|
|
533
533
|
if (n) {
|
|
534
534
|
if (l) {
|
|
535
|
-
tt((
|
|
536
|
-
const
|
|
537
|
-
return
|
|
538
|
-
...
|
|
535
|
+
tt((s) => {
|
|
536
|
+
const m = s.canvases[Z.current];
|
|
537
|
+
return m ? {
|
|
538
|
+
...s,
|
|
539
539
|
canvases: {
|
|
540
|
-
...
|
|
540
|
+
...s.canvases,
|
|
541
541
|
[Z.current]: {
|
|
542
|
-
...
|
|
543
|
-
edges:
|
|
544
|
-
if (
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
const
|
|
548
|
-
...
|
|
549
|
-
waypoints:
|
|
542
|
+
...m,
|
|
543
|
+
edges: m.edges.map((h) => {
|
|
544
|
+
if (h.id !== n.edgeId) return h;
|
|
545
|
+
const I = [...h.data.waypoints ?? []];
|
|
546
|
+
I.splice(n.waypointIndex, 1);
|
|
547
|
+
const S = {
|
|
548
|
+
...h.data,
|
|
549
|
+
waypoints: I.length > 0 ? I : void 0
|
|
550
550
|
};
|
|
551
|
-
if (
|
|
552
|
-
const u = [...
|
|
553
|
-
u.splice(n.waypointIndex, 2, null),
|
|
551
|
+
if (h.type === "simplebezier" && h.data.bezierControls) {
|
|
552
|
+
const u = [...h.data.bezierControls];
|
|
553
|
+
u.splice(n.waypointIndex, 2, null), S.bezierControls = u.some((b) => b !== null) ? u : void 0;
|
|
554
554
|
}
|
|
555
555
|
return {
|
|
556
|
-
...
|
|
557
|
-
data:
|
|
556
|
+
...h,
|
|
557
|
+
data: S
|
|
558
558
|
};
|
|
559
559
|
})
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
|
-
} :
|
|
562
|
+
} : s;
|
|
563
563
|
});
|
|
564
564
|
return;
|
|
565
565
|
}
|
|
566
|
-
|
|
566
|
+
ft.current = {
|
|
567
567
|
active: !0,
|
|
568
568
|
edgeId: n.edgeId,
|
|
569
569
|
type: "waypoint",
|
|
@@ -572,23 +572,23 @@ function fr({ onPixiReady: L }) {
|
|
|
572
572
|
return;
|
|
573
573
|
}
|
|
574
574
|
if (l) {
|
|
575
|
-
for (const
|
|
576
|
-
const
|
|
577
|
-
x:
|
|
578
|
-
y:
|
|
575
|
+
for (const s of r) if (Le(i.x, i.y, s, t, Q(k, 8, 12))) {
|
|
576
|
+
const m = Fn(i.x, i.y, s, t), h = {
|
|
577
|
+
x: i.x,
|
|
578
|
+
y: i.y
|
|
579
579
|
};
|
|
580
|
-
tt((
|
|
581
|
-
const
|
|
582
|
-
return
|
|
583
|
-
...
|
|
580
|
+
tt((I) => {
|
|
581
|
+
const S = I.canvases[Z.current];
|
|
582
|
+
return S ? {
|
|
583
|
+
...I,
|
|
584
584
|
canvases: {
|
|
585
|
-
...
|
|
585
|
+
...I.canvases,
|
|
586
586
|
[Z.current]: {
|
|
587
|
-
...
|
|
588
|
-
edges:
|
|
589
|
-
if (u.id !==
|
|
587
|
+
...S,
|
|
588
|
+
edges: S.edges.map((u) => {
|
|
589
|
+
if (u.id !== s.id) return u;
|
|
590
590
|
const b = [...u.data.waypoints ?? []];
|
|
591
|
-
b.splice(
|
|
591
|
+
b.splice(m, 0, h);
|
|
592
592
|
const _ = {
|
|
593
593
|
...u.data,
|
|
594
594
|
waypoints: b
|
|
@@ -596,7 +596,7 @@ function fr({ onPixiReady: L }) {
|
|
|
596
596
|
if (u.type === "simplebezier" && u.data.bezierControls) {
|
|
597
597
|
const J = [...u.data.bezierControls];
|
|
598
598
|
for (; J.length < (u.data.waypoints ?? []).length + 1; ) J.push(null);
|
|
599
|
-
J.splice(
|
|
599
|
+
J.splice(m, 1, null, null), _.bezierControls = J;
|
|
600
600
|
}
|
|
601
601
|
return {
|
|
602
602
|
...u,
|
|
@@ -605,87 +605,87 @@ function fr({ onPixiReady: L }) {
|
|
|
605
605
|
})
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
|
-
} :
|
|
609
|
-
}),
|
|
608
|
+
} : I;
|
|
609
|
+
}), ft.current = {
|
|
610
610
|
active: !0,
|
|
611
|
-
edgeId:
|
|
611
|
+
edgeId: s.id,
|
|
612
612
|
type: "waypoint",
|
|
613
|
-
index:
|
|
613
|
+
index: m
|
|
614
614
|
};
|
|
615
615
|
return;
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
if (e && (
|
|
620
|
-
!
|
|
619
|
+
if (e && (c === "select" || c === "connect")) {
|
|
620
|
+
!C && !z.nodeIds.has(e.id) ? xt({
|
|
621
621
|
nodeIds: /* @__PURE__ */ new Set([e.id]),
|
|
622
622
|
edgeIds: /* @__PURE__ */ new Set(),
|
|
623
623
|
lineIds: /* @__PURE__ */ new Set()
|
|
624
|
-
}) :
|
|
625
|
-
const
|
|
626
|
-
return
|
|
627
|
-
nodeIds:
|
|
624
|
+
}) : C && xt((n) => {
|
|
625
|
+
const s = new Set(n.nodeIds);
|
|
626
|
+
return s.has(e.id) ? s.delete(e.id) : s.add(e.id), {
|
|
627
|
+
nodeIds: s,
|
|
628
628
|
edgeIds: /* @__PURE__ */ new Set(),
|
|
629
629
|
lineIds: /* @__PURE__ */ new Set()
|
|
630
630
|
};
|
|
631
|
-
}),
|
|
631
|
+
}), se.current && ce.current(e.position.x, e.position.y, e.width, e.height, {
|
|
632
632
|
padding: 80,
|
|
633
633
|
preserveZoom: !0,
|
|
634
634
|
duration: 280
|
|
635
635
|
});
|
|
636
|
-
const t =
|
|
637
|
-
|
|
638
|
-
const
|
|
636
|
+
const t = z.nodeIds.has(e.id) ? new Set(z.nodeIds) : /* @__PURE__ */ new Set([e.id]);
|
|
637
|
+
C && !z.nodeIds.has(e.id) && t.add(e.id);
|
|
638
|
+
const r = /* @__PURE__ */ new Set();
|
|
639
639
|
for (const n of [...t]) {
|
|
640
|
-
const
|
|
641
|
-
if (!
|
|
642
|
-
const
|
|
640
|
+
const s = p.find((b) => b.id === n);
|
|
641
|
+
if (!s || s.type !== "flowGroup" && s.type !== "geometryGroup" && !s.data.isGroup) continue;
|
|
642
|
+
const m = s.type === "geometryGroup", h = s.position.x, I = s.position.y, S = s.width, u = s.height;
|
|
643
643
|
for (const b of p)
|
|
644
644
|
if (!(t.has(b.id) || b.id === n)) {
|
|
645
645
|
if (b.parentId === n) {
|
|
646
646
|
t.add(b.id);
|
|
647
647
|
continue;
|
|
648
648
|
}
|
|
649
|
-
|
|
649
|
+
m && b.position.x >= h && b.position.y >= I && b.position.x + b.width <= h + S && b.position.y + b.height <= I + u && t.add(b.id);
|
|
650
650
|
}
|
|
651
|
-
for (const b of X.current.lines) b.parentId === n &&
|
|
652
|
-
if (
|
|
653
|
-
|
|
651
|
+
for (const b of X.current.lines) b.parentId === n && r.add(b.id);
|
|
652
|
+
if (m) for (const b of X.current.lines)
|
|
653
|
+
r.has(b.id) || b.points.length > 0 && b.points.every((_) => _.x >= h && _.x <= h + S && _.y >= I && _.y <= I + u) && r.add(b.id);
|
|
654
654
|
}
|
|
655
655
|
const a = /* @__PURE__ */ new Map();
|
|
656
656
|
for (const n of p) t.has(n.id) && a.set(n.id, { ...n.position });
|
|
657
|
-
const
|
|
658
|
-
if (
|
|
659
|
-
for (const n of X.current.lines)
|
|
660
|
-
|
|
657
|
+
const d = /* @__PURE__ */ new Map();
|
|
658
|
+
if (r.size > 0)
|
|
659
|
+
for (const n of X.current.lines) r.has(n.id) && d.set(n.id, n.points.map((s) => ({ ...s })));
|
|
660
|
+
ct.current = {
|
|
661
661
|
active: !0,
|
|
662
662
|
nodeIds: t,
|
|
663
|
-
lineIds:
|
|
664
|
-
startWorld:
|
|
663
|
+
lineIds: r.size > 0 ? r : void 0,
|
|
664
|
+
startWorld: i,
|
|
665
665
|
nodeStarts: a,
|
|
666
|
-
linePointStarts:
|
|
667
|
-
},
|
|
666
|
+
linePointStarts: d.size > 0 ? d : void 0
|
|
667
|
+
}, ze.current();
|
|
668
668
|
return;
|
|
669
669
|
}
|
|
670
670
|
const y = /* @__PURE__ */ new Map();
|
|
671
671
|
for (const t of p) y.set(t.id, t);
|
|
672
|
-
const
|
|
673
|
-
for (const t of
|
|
674
|
-
if (
|
|
675
|
-
const a = new Set(
|
|
672
|
+
const E = Q(k, 8, 12);
|
|
673
|
+
for (const t of H) if (Le(i.x, i.y, t, y, E)) {
|
|
674
|
+
if (xt(C ? (r) => {
|
|
675
|
+
const a = new Set(r.edgeIds);
|
|
676
676
|
return a.has(t.id) ? a.delete(t.id) : a.add(t.id), {
|
|
677
|
-
...
|
|
677
|
+
...r,
|
|
678
678
|
edgeIds: a
|
|
679
679
|
};
|
|
680
680
|
} : {
|
|
681
681
|
nodeIds: /* @__PURE__ */ new Set(),
|
|
682
682
|
edgeIds: /* @__PURE__ */ new Set([t.id]),
|
|
683
683
|
lineIds: /* @__PURE__ */ new Set()
|
|
684
|
-
}),
|
|
685
|
-
const
|
|
686
|
-
if (
|
|
687
|
-
const
|
|
688
|
-
ce.current(
|
|
684
|
+
}), se.current) {
|
|
685
|
+
const r = y.get(t.source), a = y.get(t.target);
|
|
686
|
+
if (r && a) {
|
|
687
|
+
const d = Math.min(r.position.x, a.position.x), n = Math.min(r.position.y, a.position.y), s = Math.max(r.position.x + r.width, a.position.x + a.width), m = Math.max(r.position.y + r.height, a.position.y + a.height);
|
|
688
|
+
ce.current(d, n, s - d, m - n, {
|
|
689
689
|
padding: 80,
|
|
690
690
|
preserveZoom: !0,
|
|
691
691
|
duration: 280
|
|
@@ -694,117 +694,117 @@ function fr({ onPixiReady: L }) {
|
|
|
694
694
|
}
|
|
695
695
|
return;
|
|
696
696
|
}
|
|
697
|
-
for (const t of
|
|
698
|
-
const
|
|
699
|
-
if (
|
|
700
|
-
const
|
|
701
|
-
return
|
|
697
|
+
for (const t of N) if (wn(i.x, i.y, t, E)) {
|
|
698
|
+
const r = z.lineIds.has(t.id);
|
|
699
|
+
if (C ? xt((n) => {
|
|
700
|
+
const s = new Set(n.lineIds);
|
|
701
|
+
return s.has(t.id) ? s.delete(t.id) : s.add(t.id), {
|
|
702
702
|
...n,
|
|
703
|
-
lineIds:
|
|
703
|
+
lineIds: s
|
|
704
704
|
};
|
|
705
|
-
}) :
|
|
705
|
+
}) : r || xt({
|
|
706
706
|
nodeIds: /* @__PURE__ */ new Set(),
|
|
707
707
|
edgeIds: /* @__PURE__ */ new Set(),
|
|
708
708
|
lineIds: /* @__PURE__ */ new Set([t.id])
|
|
709
|
-
}),
|
|
710
|
-
const n = t.points.map((u) => u.x),
|
|
711
|
-
ce.current(
|
|
709
|
+
}), se.current && t.points.length > 0) {
|
|
710
|
+
const n = t.points.map((u) => u.x), s = t.points.map((u) => u.y), m = Math.min(...n), h = Math.min(...s), I = Math.max(...n), S = Math.max(...s);
|
|
711
|
+
ce.current(m, h, Math.max(1, I - m), Math.max(1, S - h), {
|
|
712
712
|
padding: 80,
|
|
713
713
|
preserveZoom: !0,
|
|
714
714
|
duration: 280
|
|
715
715
|
});
|
|
716
716
|
}
|
|
717
|
-
const a =
|
|
718
|
-
for (const n of
|
|
719
|
-
|
|
717
|
+
const a = r ? new Set(z.lineIds) : /* @__PURE__ */ new Set([t.id]), d = /* @__PURE__ */ new Map();
|
|
718
|
+
for (const n of N) a.has(n.id) && d.set(n.id, n.points.map((s) => ({ ...s })));
|
|
719
|
+
vt.current = {
|
|
720
720
|
active: !0,
|
|
721
721
|
lineIds: a,
|
|
722
|
-
startWorld:
|
|
723
|
-
pointStarts:
|
|
722
|
+
startWorld: i,
|
|
723
|
+
pointStarts: d
|
|
724
724
|
};
|
|
725
725
|
return;
|
|
726
726
|
}
|
|
727
|
-
|
|
727
|
+
C || xt({
|
|
728
728
|
nodeIds: /* @__PURE__ */ new Set(),
|
|
729
729
|
edgeIds: /* @__PURE__ */ new Set(),
|
|
730
730
|
lineIds: /* @__PURE__ */ new Set()
|
|
731
|
-
}),
|
|
731
|
+
}), c === "select" && (nt.current = {
|
|
732
732
|
active: !0,
|
|
733
733
|
startScreen: {
|
|
734
|
-
x:
|
|
735
|
-
y:
|
|
734
|
+
x: g.global.x,
|
|
735
|
+
y: g.global.y
|
|
736
736
|
}
|
|
737
737
|
});
|
|
738
|
-
}), bt.on("globalpointermove", (
|
|
739
|
-
const
|
|
740
|
-
if (
|
|
741
|
-
const
|
|
742
|
-
if (
|
|
743
|
-
const p = X.current.nodes,
|
|
744
|
-
let
|
|
745
|
-
for (let
|
|
746
|
-
const
|
|
747
|
-
|
|
738
|
+
}), bt.on("globalpointermove", (g) => {
|
|
739
|
+
const c = dt.current(g.global.x, g.global.y);
|
|
740
|
+
if (Ze.current = c, V.current?.multiTouchActive) return;
|
|
741
|
+
const i = oe.current;
|
|
742
|
+
if (i === "freehand" || i === "line" || i === "polyline" || i === "arrow") return;
|
|
743
|
+
const p = X.current.nodes, H = X.current.edges, N = V.current?.state.zoom ?? 1, z = !ct.current?.active && !rt.current?.active && !gt.current?.active && !it.current?.active && !ft.current?.active && !vt.current?.active && !ht.current?.active;
|
|
744
|
+
let C = null;
|
|
745
|
+
for (let o = p.length - 1; o >= 0; o--) if (Vt(c.x, c.y, p[o])) {
|
|
746
|
+
const x = p[o];
|
|
747
|
+
C = x.parentId ? p.find((l) => l.id === x.parentId)?.id ?? x.id : x.id;
|
|
748
748
|
break;
|
|
749
749
|
}
|
|
750
|
-
if (
|
|
751
|
-
const
|
|
752
|
-
for (const y of p)
|
|
753
|
-
const
|
|
754
|
-
|
|
755
|
-
let
|
|
756
|
-
if (
|
|
757
|
-
const y = p.find((
|
|
750
|
+
if (kt.current = C, z && (i === "select" || i === "connect")) {
|
|
751
|
+
const o = /* @__PURE__ */ new Map();
|
|
752
|
+
for (const y of p) o.set(y.id, y);
|
|
753
|
+
const x = re.current, l = x.edgeIds.size > 0 ? H.filter((y) => x.edgeIds.has(y.id)) : [], e = l.length > 0 ? pn(c.x, c.y, l, o, Q(N, 12, 18)) : null;
|
|
754
|
+
Wt.current = e;
|
|
755
|
+
let w = null;
|
|
756
|
+
if (C) {
|
|
757
|
+
const y = p.find((E) => E.id === C);
|
|
758
758
|
if (y) {
|
|
759
|
-
const
|
|
760
|
-
if (
|
|
761
|
-
const
|
|
762
|
-
|
|
759
|
+
const E = Mt(y.width, y.height), t = Ft(E, y, c.x, c.y, Q(N, 14, 20));
|
|
760
|
+
if (t) {
|
|
761
|
+
const r = Bt(t, y);
|
|
762
|
+
w = {
|
|
763
763
|
nodeId: y.id,
|
|
764
|
-
handleId:
|
|
765
|
-
wx:
|
|
766
|
-
wy:
|
|
764
|
+
handleId: t.id,
|
|
765
|
+
wx: r.x,
|
|
766
|
+
wy: r.y
|
|
767
767
|
};
|
|
768
768
|
}
|
|
769
769
|
}
|
|
770
770
|
}
|
|
771
|
-
|
|
771
|
+
Gt.current = w;
|
|
772
772
|
}
|
|
773
|
-
const
|
|
774
|
-
if (
|
|
775
|
-
const
|
|
776
|
-
let
|
|
777
|
-
if (
|
|
778
|
-
else if (
|
|
779
|
-
else if (
|
|
780
|
-
const l =
|
|
773
|
+
const k = R.current;
|
|
774
|
+
if (k && z) {
|
|
775
|
+
const o = re.current;
|
|
776
|
+
let x = "";
|
|
777
|
+
if (Wt.current) x = "crosshair";
|
|
778
|
+
else if (Gt.current) x = "crosshair";
|
|
779
|
+
else if (o.edgeIds.size > 0 && i === "select") {
|
|
780
|
+
const l = H.filter((y) => o.edgeIds.has(y.id)), e = /* @__PURE__ */ new Map();
|
|
781
781
|
for (const y of p) e.set(y.id, y);
|
|
782
|
-
const
|
|
783
|
-
(
|
|
782
|
+
const w = Q(N, 10, 14);
|
|
783
|
+
(xn(c.x, c.y, l, w) || gn(c.x, c.y, l, e, w)) && (x = "grab");
|
|
784
784
|
}
|
|
785
|
-
if (!
|
|
786
|
-
const l = p.find((e) => e.id === [...
|
|
785
|
+
if (!x && o.nodeIds.size === 1 && i === "select") {
|
|
786
|
+
const l = p.find((e) => e.id === [...o.nodeIds][0]);
|
|
787
787
|
if (l) {
|
|
788
|
-
const e =
|
|
789
|
-
if (e)
|
|
790
|
-
else if (!
|
|
791
|
-
const
|
|
792
|
-
Math.hypot(
|
|
788
|
+
const e = yn(c, l, Q(N, 10, 16));
|
|
789
|
+
if (e) x = On[e];
|
|
790
|
+
else if (!jt.current) {
|
|
791
|
+
const w = hn(l, N);
|
|
792
|
+
Math.hypot(c.x - w.x, c.y - w.y) < Q(N, 12, 24) && (x = "grab");
|
|
793
793
|
}
|
|
794
794
|
}
|
|
795
795
|
}
|
|
796
|
-
if (!
|
|
797
|
-
const l = X.current.lines, e = Q(
|
|
798
|
-
for (const
|
|
799
|
-
|
|
796
|
+
if (!x && i === "select") {
|
|
797
|
+
const l = X.current.lines, e = Q(N, 8, 12);
|
|
798
|
+
for (const w of l) if (wn(c.x, c.y, w, e)) {
|
|
799
|
+
x = "move";
|
|
800
800
|
break;
|
|
801
801
|
}
|
|
802
802
|
}
|
|
803
|
-
|
|
803
|
+
k.style.cursor = x;
|
|
804
804
|
}
|
|
805
|
-
if (
|
|
806
|
-
const
|
|
807
|
-
id:
|
|
805
|
+
if (gt.current?.active) {
|
|
806
|
+
const o = gt.current, x = c.x - o.startWorld.x, l = c.y - o.startWorld.y, e = Bn(o.startBounds, o.handle, x, l), w = X.current.nodes, y = {
|
|
807
|
+
id: o.nodeId,
|
|
808
808
|
type: "shapeRect",
|
|
809
809
|
position: {
|
|
810
810
|
x: e.x,
|
|
@@ -813,74 +813,74 @@ function fr({ onPixiReady: L }) {
|
|
|
813
813
|
width: e.w,
|
|
814
814
|
height: e.h,
|
|
815
815
|
data: {}
|
|
816
|
-
}],
|
|
817
|
-
if (e.x +=
|
|
818
|
-
const
|
|
819
|
-
(
|
|
816
|
+
}, E = ve([y], w);
|
|
817
|
+
if (e.x += E.dx, e.y += E.dy, (o.handle === "ne" || o.handle === "se") && (e.w += E.dx), (o.handle === "se" || o.handle === "sw") && (e.h += E.dy), Lt.current = E.guides, Jt.current && Nt.current > 0 && E.guides.length === 0) {
|
|
818
|
+
const s = Nt.current;
|
|
819
|
+
(o.handle === "nw" || o.handle === "sw") && (e.x = Math.round(e.x / s) * s), (o.handle === "nw" || o.handle === "ne") && (e.y = Math.round(e.y / s) * s), (o.handle === "ne" || o.handle === "se") && (e.w = Math.round((e.x + e.w) / s) * s - e.x), (o.handle === "se" || o.handle === "sw") && (e.h = Math.round((e.y + e.h) / s) * s - e.y);
|
|
820
820
|
}
|
|
821
|
-
const
|
|
822
|
-
tt((
|
|
823
|
-
const
|
|
824
|
-
return
|
|
825
|
-
...
|
|
821
|
+
const t = o.startBounds, r = Math.max(e.w, 24), a = Math.max(e.h, 24), d = t.w > 0 ? r / t.w : 1, n = t.h > 0 ? a / t.h : 1;
|
|
822
|
+
tt((s) => {
|
|
823
|
+
const m = s.canvases[Z.current];
|
|
824
|
+
return m ? {
|
|
825
|
+
...s,
|
|
826
826
|
canvases: {
|
|
827
|
-
...
|
|
827
|
+
...s.canvases,
|
|
828
828
|
[Z.current]: {
|
|
829
|
-
...
|
|
830
|
-
nodes:
|
|
831
|
-
if (
|
|
832
|
-
...
|
|
829
|
+
...m,
|
|
830
|
+
nodes: m.nodes.map((h) => {
|
|
831
|
+
if (h.id === o.nodeId) return {
|
|
832
|
+
...h,
|
|
833
833
|
position: {
|
|
834
834
|
x: e.x,
|
|
835
835
|
y: e.y
|
|
836
836
|
},
|
|
837
|
-
width:
|
|
838
|
-
height:
|
|
837
|
+
width: r,
|
|
838
|
+
height: a
|
|
839
839
|
};
|
|
840
|
-
const
|
|
841
|
-
return
|
|
842
|
-
...
|
|
840
|
+
const I = o.childStarts.get(h.id);
|
|
841
|
+
return I ? {
|
|
842
|
+
...h,
|
|
843
843
|
position: {
|
|
844
|
-
x: e.x + (
|
|
845
|
-
y: e.y + (
|
|
844
|
+
x: e.x + (I.x - t.x) * d,
|
|
845
|
+
y: e.y + (I.y - t.y) * n
|
|
846
846
|
},
|
|
847
|
-
width: Math.max(
|
|
848
|
-
height: Math.max(
|
|
849
|
-
} :
|
|
847
|
+
width: Math.max(I.w * d, 24),
|
|
848
|
+
height: Math.max(I.h * n, 24)
|
|
849
|
+
} : h;
|
|
850
850
|
}),
|
|
851
|
-
lines:
|
|
852
|
-
const
|
|
853
|
-
return
|
|
854
|
-
...
|
|
855
|
-
points:
|
|
856
|
-
x: e.x + (
|
|
857
|
-
y: e.y + (
|
|
851
|
+
lines: o.childLineStarts ? m.lines.map((h) => {
|
|
852
|
+
const I = o.childLineStarts.get(h.id);
|
|
853
|
+
return I ? {
|
|
854
|
+
...h,
|
|
855
|
+
points: I.map((S) => ({
|
|
856
|
+
x: e.x + (S.x - t.x) * d,
|
|
857
|
+
y: e.y + (S.y - t.y) * n
|
|
858
858
|
}))
|
|
859
|
-
} :
|
|
860
|
-
}) :
|
|
859
|
+
} : h;
|
|
860
|
+
}) : m.lines
|
|
861
861
|
}
|
|
862
862
|
}
|
|
863
|
-
} :
|
|
863
|
+
} : s;
|
|
864
864
|
});
|
|
865
865
|
return;
|
|
866
866
|
}
|
|
867
|
-
if (
|
|
868
|
-
const
|
|
869
|
-
let l = ((
|
|
870
|
-
if (
|
|
867
|
+
if (ht.current?.active) {
|
|
868
|
+
const o = ht.current, x = (Math.atan2(c.y - o.cy, c.x - o.cx) - o.startPointerAngle) * 180 / Math.PI;
|
|
869
|
+
let l = ((o.startRotation + x) % 360 + 360) % 360;
|
|
870
|
+
if (g.shiftKey) l = Math.round(l / 15) * 15 % 360;
|
|
871
871
|
else {
|
|
872
872
|
const e = Math.round(l / 45) * 45;
|
|
873
873
|
Math.abs(l - e) < 4 && (l = (e % 360 + 360) % 360);
|
|
874
874
|
}
|
|
875
875
|
tt((e) => {
|
|
876
|
-
const
|
|
877
|
-
return
|
|
876
|
+
const w = e.canvases[Z.current];
|
|
877
|
+
return w ? {
|
|
878
878
|
...e,
|
|
879
879
|
canvases: {
|
|
880
880
|
...e.canvases,
|
|
881
881
|
[Z.current]: {
|
|
882
|
-
...
|
|
883
|
-
nodes:
|
|
882
|
+
...w,
|
|
883
|
+
nodes: w.nodes.map((y) => y.id === o.nodeId ? {
|
|
884
884
|
...y,
|
|
885
885
|
data: {
|
|
886
886
|
...y.data,
|
|
@@ -890,67 +890,67 @@ function fr({ onPixiReady: L }) {
|
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
892
|
} : e;
|
|
893
|
-
}),
|
|
893
|
+
}), R.current && (R.current.style.cursor = "grabbing");
|
|
894
894
|
return;
|
|
895
895
|
}
|
|
896
|
-
if (
|
|
897
|
-
const
|
|
898
|
-
for (const e of
|
|
896
|
+
if (ft.current?.active) {
|
|
897
|
+
const o = ft.current, x = X.current.nodes, l = /* @__PURE__ */ new Map();
|
|
898
|
+
for (const e of x) l.set(e.id, e);
|
|
899
899
|
tt((e) => {
|
|
900
|
-
const
|
|
901
|
-
return
|
|
900
|
+
const w = e.canvases[Z.current];
|
|
901
|
+
return w ? {
|
|
902
902
|
...e,
|
|
903
903
|
canvases: {
|
|
904
904
|
...e.canvases,
|
|
905
905
|
[Z.current]: {
|
|
906
|
-
...
|
|
907
|
-
edges:
|
|
908
|
-
if (y.id !==
|
|
909
|
-
if (
|
|
910
|
-
const
|
|
911
|
-
return
|
|
912
|
-
x:
|
|
913
|
-
y:
|
|
906
|
+
...w,
|
|
907
|
+
edges: w.edges.map((y) => {
|
|
908
|
+
if (y.id !== o.edgeId) return y;
|
|
909
|
+
if (o.type === "waypoint") {
|
|
910
|
+
const Ot = [...y.data.waypoints ?? []];
|
|
911
|
+
return o.index < Ot.length && (Ot[o.index] = {
|
|
912
|
+
x: c.x,
|
|
913
|
+
y: c.y
|
|
914
914
|
}), {
|
|
915
915
|
...y,
|
|
916
916
|
data: {
|
|
917
917
|
...y.data,
|
|
918
|
-
waypoints:
|
|
918
|
+
waypoints: Ot
|
|
919
919
|
}
|
|
920
920
|
};
|
|
921
921
|
}
|
|
922
|
-
const
|
|
923
|
-
if (!
|
|
924
|
-
const t = y.data.waypoints ?? [],
|
|
922
|
+
const E = St(y, l);
|
|
923
|
+
if (!E) return y;
|
|
924
|
+
const t = y.data.waypoints ?? [], r = [
|
|
925
925
|
{
|
|
926
|
-
x:
|
|
927
|
-
y:
|
|
926
|
+
x: E.sx,
|
|
927
|
+
y: E.sy
|
|
928
928
|
},
|
|
929
929
|
...t,
|
|
930
930
|
{
|
|
931
|
-
x:
|
|
932
|
-
y:
|
|
931
|
+
x: E.tx,
|
|
932
|
+
y: E.ty
|
|
933
933
|
}
|
|
934
|
-
], a =
|
|
935
|
-
for (;
|
|
936
|
-
const n =
|
|
934
|
+
], a = r.length - 1, d = [...y.data.bezierControls ?? []];
|
|
935
|
+
for (; d.length < a; ) d.push(null);
|
|
936
|
+
const n = o.index;
|
|
937
937
|
if (n >= a) return y;
|
|
938
|
-
const
|
|
939
|
-
return
|
|
940
|
-
c1x:
|
|
941
|
-
c1y:
|
|
942
|
-
c2x:
|
|
943
|
-
c2y:
|
|
944
|
-
} :
|
|
945
|
-
c1x:
|
|
946
|
-
c1y:
|
|
947
|
-
c2x:
|
|
948
|
-
c2y:
|
|
938
|
+
const s = r[n], m = r[n + 1], h = d[n], I = Math.hypot(m.x - s.x, m.y - s.y), S = Math.max(30, I * 0.3), u = a - 1, b = n === 0 ? s.x + E.snx * S : s.x + (m.x - s.x) * 0.4, _ = n === 0 ? s.y + E.sny * S : s.y, J = n === u ? m.x + E.tnx * S : m.x - (m.x - s.x) * 0.4, _t = n === u ? m.y + E.tny * S : m.y;
|
|
939
|
+
return o.type === "bezierC1" ? d[n] = {
|
|
940
|
+
c1x: c.x,
|
|
941
|
+
c1y: c.y,
|
|
942
|
+
c2x: h?.c2x ?? J,
|
|
943
|
+
c2y: h?.c2y ?? _t
|
|
944
|
+
} : d[n] = {
|
|
945
|
+
c1x: h?.c1x ?? b,
|
|
946
|
+
c1y: h?.c1y ?? _,
|
|
947
|
+
c2x: c.x,
|
|
948
|
+
c2y: c.y
|
|
949
949
|
}, {
|
|
950
950
|
...y,
|
|
951
951
|
data: {
|
|
952
952
|
...y.data,
|
|
953
|
-
bezierControls:
|
|
953
|
+
bezierControls: d
|
|
954
954
|
}
|
|
955
955
|
};
|
|
956
956
|
})
|
|
@@ -960,22 +960,22 @@ function fr({ onPixiReady: L }) {
|
|
|
960
960
|
});
|
|
961
961
|
return;
|
|
962
962
|
}
|
|
963
|
-
if (
|
|
964
|
-
const
|
|
963
|
+
if (vt.current?.active) {
|
|
964
|
+
const o = vt.current, x = c.x - o.startWorld.x, l = c.y - o.startWorld.y;
|
|
965
965
|
tt((e) => {
|
|
966
|
-
const
|
|
967
|
-
return
|
|
966
|
+
const w = e.canvases[Z.current];
|
|
967
|
+
return w ? {
|
|
968
968
|
...e,
|
|
969
969
|
canvases: {
|
|
970
970
|
...e.canvases,
|
|
971
971
|
[Z.current]: {
|
|
972
|
-
...
|
|
973
|
-
lines:
|
|
974
|
-
const
|
|
975
|
-
return
|
|
972
|
+
...w,
|
|
973
|
+
lines: w.lines.map((y) => {
|
|
974
|
+
const E = o.pointStarts.get(y.id);
|
|
975
|
+
return E ? {
|
|
976
976
|
...y,
|
|
977
|
-
points:
|
|
978
|
-
x: t.x +
|
|
977
|
+
points: E.map((t) => ({
|
|
978
|
+
x: t.x + x,
|
|
979
979
|
y: t.y + l
|
|
980
980
|
}))
|
|
981
981
|
} : y;
|
|
@@ -986,109 +986,109 @@ function fr({ onPixiReady: L }) {
|
|
|
986
986
|
});
|
|
987
987
|
return;
|
|
988
988
|
}
|
|
989
|
-
if (
|
|
990
|
-
const
|
|
991
|
-
let e =
|
|
992
|
-
if (
|
|
993
|
-
const
|
|
994
|
-
|
|
989
|
+
if (ct.current?.active) {
|
|
990
|
+
const o = ct.current, x = c.x - o.startWorld.x, l = c.y - o.startWorld.y;
|
|
991
|
+
let e = x, w = l;
|
|
992
|
+
if (Jt.current && Nt.current > 0 && o.nodeIds.size > 0) {
|
|
993
|
+
const r = Nt.current, a = o.nodeStarts.values().next().value;
|
|
994
|
+
a && (e = Zt(a.x + x, r, !0) - a.x, w = Zt(a.y + l, r, !0) - a.y);
|
|
995
995
|
}
|
|
996
|
-
const y = X.current.nodes,
|
|
997
|
-
const
|
|
996
|
+
const y = X.current.nodes, E = y.filter((r) => o.nodeIds.has(r.id)).map((r) => {
|
|
997
|
+
const a = o.nodeStarts.get(r.id);
|
|
998
998
|
return {
|
|
999
|
-
...
|
|
999
|
+
...r,
|
|
1000
1000
|
position: {
|
|
1001
|
-
x:
|
|
1002
|
-
y:
|
|
1001
|
+
x: a.x + e,
|
|
1002
|
+
y: a.y + w
|
|
1003
1003
|
}
|
|
1004
1004
|
};
|
|
1005
|
-
}), y);
|
|
1006
|
-
e +=
|
|
1007
|
-
const
|
|
1008
|
-
return
|
|
1009
|
-
...
|
|
1005
|
+
}), t = ve(E, y);
|
|
1006
|
+
e += t.dx, w += t.dy, Lt.current = t.guides, tt((r) => {
|
|
1007
|
+
const a = r.canvases[Z.current];
|
|
1008
|
+
return a ? {
|
|
1009
|
+
...r,
|
|
1010
1010
|
canvases: {
|
|
1011
|
-
...
|
|
1011
|
+
...r.canvases,
|
|
1012
1012
|
[Z.current]: {
|
|
1013
|
-
...
|
|
1014
|
-
nodes:
|
|
1015
|
-
const
|
|
1016
|
-
return
|
|
1017
|
-
...
|
|
1013
|
+
...a,
|
|
1014
|
+
nodes: a.nodes.map((d) => {
|
|
1015
|
+
const n = o.nodeStarts.get(d.id);
|
|
1016
|
+
return n ? {
|
|
1017
|
+
...d,
|
|
1018
1018
|
position: {
|
|
1019
|
-
x:
|
|
1020
|
-
y:
|
|
1019
|
+
x: n.x + e,
|
|
1020
|
+
y: n.y + w
|
|
1021
1021
|
}
|
|
1022
|
-
} :
|
|
1022
|
+
} : d;
|
|
1023
1023
|
}),
|
|
1024
|
-
lines:
|
|
1025
|
-
const
|
|
1026
|
-
return
|
|
1027
|
-
...
|
|
1028
|
-
points:
|
|
1029
|
-
x:
|
|
1030
|
-
y:
|
|
1024
|
+
lines: o.linePointStarts ? a.lines.map((d) => {
|
|
1025
|
+
const n = o.linePointStarts.get(d.id);
|
|
1026
|
+
return n ? {
|
|
1027
|
+
...d,
|
|
1028
|
+
points: n.map((s) => ({
|
|
1029
|
+
x: s.x + e,
|
|
1030
|
+
y: s.y + w
|
|
1031
1031
|
}))
|
|
1032
|
-
} :
|
|
1033
|
-
}) :
|
|
1032
|
+
} : d;
|
|
1033
|
+
}) : a.lines
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
1036
|
-
} :
|
|
1036
|
+
} : r;
|
|
1037
1037
|
});
|
|
1038
1038
|
return;
|
|
1039
1039
|
}
|
|
1040
|
-
if (nt.current?.active &&
|
|
1041
|
-
const
|
|
1042
|
-
|
|
1040
|
+
if (nt.current?.active && Tt.current) {
|
|
1041
|
+
const o = Math.min(nt.current.startScreen.x, g.global.x), x = Math.min(nt.current.startScreen.y, g.global.y), l = Math.abs(g.global.x - nt.current.startScreen.x), e = Math.abs(g.global.y - nt.current.startScreen.y);
|
|
1042
|
+
Tt.current.showMarquee(o, x, l, e);
|
|
1043
1043
|
}
|
|
1044
|
-
if (rt.current?.active &&
|
|
1045
|
-
const
|
|
1046
|
-
if (
|
|
1047
|
-
const
|
|
1048
|
-
if (
|
|
1049
|
-
const l =
|
|
1050
|
-
let y =
|
|
1051
|
-
const t =
|
|
1044
|
+
if (rt.current?.active && mt.current) {
|
|
1045
|
+
const o = X.current.nodes.find((x) => x.id === rt.current.sourceNodeId);
|
|
1046
|
+
if (o) {
|
|
1047
|
+
const x = Mt(o.width, o.height).find((l) => l.id === rt.current.sourceHandleId);
|
|
1048
|
+
if (x) {
|
|
1049
|
+
const l = Bt(x, o), e = l.x, w = l.y;
|
|
1050
|
+
let y = c.x, E = c.y;
|
|
1051
|
+
const t = kt.current;
|
|
1052
1052
|
if (t && t !== rt.current.sourceNodeId) {
|
|
1053
|
-
const a = X.current.nodes.find((
|
|
1053
|
+
const a = X.current.nodes.find((d) => d.id === t);
|
|
1054
1054
|
if (a) {
|
|
1055
|
-
const
|
|
1056
|
-
if (
|
|
1057
|
-
const
|
|
1058
|
-
y =
|
|
1055
|
+
const d = Mt(a.width, a.height), n = Ft(d, a, c.x, c.y, 1 / 0);
|
|
1056
|
+
if (n) {
|
|
1057
|
+
const s = Bt(n, a);
|
|
1058
|
+
y = s.x, E = s.y;
|
|
1059
1059
|
}
|
|
1060
1060
|
}
|
|
1061
1061
|
}
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1062
|
+
const r = mt.current;
|
|
1063
|
+
r.clear(), r.moveTo(e, w).lineTo(y, E).stroke({
|
|
1064
1064
|
color: 3900150,
|
|
1065
1065
|
width: 2,
|
|
1066
1066
|
alpha: 0.6
|
|
1067
|
-
}),
|
|
1067
|
+
}), r.visible = !0;
|
|
1068
1068
|
}
|
|
1069
1069
|
}
|
|
1070
1070
|
}
|
|
1071
|
-
if (
|
|
1072
|
-
const
|
|
1073
|
-
if (
|
|
1074
|
-
const l = Mt(
|
|
1075
|
-
x:
|
|
1076
|
-
y:
|
|
1077
|
-
},
|
|
1078
|
-
let
|
|
1079
|
-
const
|
|
1080
|
-
if (
|
|
1081
|
-
const
|
|
1082
|
-
if (
|
|
1083
|
-
const n =
|
|
1084
|
-
if (
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1071
|
+
if (it.current?.active && mt.current && !mt.current.destroyed) {
|
|
1072
|
+
const o = it.current, x = X.current.nodes.find((l) => l.id === o.fixedNodeId);
|
|
1073
|
+
if (x) {
|
|
1074
|
+
const l = Mt(x.width, x.height).find((d) => d.id === o.fixedHandleId), e = l ? Bt(l, x) : {
|
|
1075
|
+
x: x.position.x + x.width / 2,
|
|
1076
|
+
y: x.position.y + x.height / 2
|
|
1077
|
+
}, w = e.x, y = e.y;
|
|
1078
|
+
let E = c.x, t = c.y;
|
|
1079
|
+
const r = kt.current;
|
|
1080
|
+
if (r && r !== o.fixedNodeId) {
|
|
1081
|
+
const d = X.current.nodes.find((n) => n.id === r);
|
|
1082
|
+
if (d) {
|
|
1083
|
+
const n = Mt(d.width, d.height), s = Ft(n, d, c.x, c.y, 1 / 0);
|
|
1084
|
+
if (s) {
|
|
1085
|
+
const m = Bt(s, d);
|
|
1086
|
+
E = m.x, t = m.y;
|
|
1087
1087
|
}
|
|
1088
1088
|
}
|
|
1089
1089
|
}
|
|
1090
|
-
const a =
|
|
1091
|
-
a.clear(), a.moveTo(
|
|
1090
|
+
const a = mt.current;
|
|
1091
|
+
a.clear(), a.moveTo(w, y).lineTo(E, t).stroke({
|
|
1092
1092
|
color: 16347926,
|
|
1093
1093
|
width: 2,
|
|
1094
1094
|
alpha: 0.7
|
|
@@ -1097,108 +1097,108 @@ function fr({ onPixiReady: L }) {
|
|
|
1097
1097
|
}
|
|
1098
1098
|
});
|
|
1099
1099
|
const Pt = () => {
|
|
1100
|
-
|
|
1100
|
+
Lt.current = [];
|
|
1101
1101
|
try {
|
|
1102
|
-
|
|
1102
|
+
we.current?.clear();
|
|
1103
1103
|
} catch {
|
|
1104
1104
|
}
|
|
1105
1105
|
try {
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1106
|
+
const g = mt.current;
|
|
1107
|
+
g && !g.destroyed && (g.clear(), g.visible = !1);
|
|
1108
1108
|
} catch {
|
|
1109
1109
|
}
|
|
1110
|
-
|
|
1110
|
+
R.current && (R.current.style.cursor = "");
|
|
1111
1111
|
};
|
|
1112
|
-
bt.on("pointerup", (
|
|
1113
|
-
if (Pt(),
|
|
1114
|
-
|
|
1112
|
+
bt.on("pointerup", (g) => {
|
|
1113
|
+
if (Pt(), ht.current?.active) {
|
|
1114
|
+
ht.current = null, Ht.current();
|
|
1115
1115
|
return;
|
|
1116
1116
|
}
|
|
1117
|
-
if (
|
|
1118
|
-
|
|
1117
|
+
if (ft.current?.active) {
|
|
1118
|
+
ft.current = null;
|
|
1119
1119
|
return;
|
|
1120
1120
|
}
|
|
1121
|
-
if (
|
|
1122
|
-
|
|
1121
|
+
if (gt.current?.active) {
|
|
1122
|
+
gt.current = null;
|
|
1123
1123
|
return;
|
|
1124
1124
|
}
|
|
1125
|
-
if (
|
|
1126
|
-
|
|
1125
|
+
if (vt.current?.active) {
|
|
1126
|
+
vt.current = null;
|
|
1127
1127
|
return;
|
|
1128
1128
|
}
|
|
1129
|
-
if (
|
|
1130
|
-
const
|
|
1131
|
-
if (
|
|
1132
|
-
const
|
|
1133
|
-
|
|
1134
|
-
nodeIds: new Set(
|
|
1129
|
+
if (ct.current?.active && (ct.current = null, Ht.current()), nt.current?.active) {
|
|
1130
|
+
const c = dt.current(nt.current.startScreen.x, nt.current.startScreen.y), i = dt.current(g.global.x, g.global.y), p = Math.min(c.x, i.x), H = Math.min(c.y, i.y), N = Math.abs(i.x - c.x), z = Math.abs(i.y - c.y);
|
|
1131
|
+
if (N > 4 && z > 4) {
|
|
1132
|
+
const C = X.current.nodes.filter((o) => Dn(p, H, N, z, o.position.x, o.position.y, o.width, o.height)), k = X.current.lines.filter((o) => o.points.length === 0 ? !1 : o.points.every((x) => x.x >= p && x.x <= p + N && x.y >= H && x.y <= H + z));
|
|
1133
|
+
xt({
|
|
1134
|
+
nodeIds: new Set(C.map((o) => o.id)),
|
|
1135
1135
|
edgeIds: /* @__PURE__ */ new Set(),
|
|
1136
|
-
lineIds: new Set(
|
|
1136
|
+
lineIds: new Set(k.map((o) => o.id))
|
|
1137
1137
|
});
|
|
1138
1138
|
}
|
|
1139
|
-
nt.current = null,
|
|
1139
|
+
nt.current = null, Tt.current?.hideMarquee();
|
|
1140
1140
|
}
|
|
1141
|
-
if (
|
|
1142
|
-
const
|
|
1143
|
-
|
|
1144
|
-
const
|
|
1145
|
-
let
|
|
1146
|
-
for (let
|
|
1147
|
-
|
|
1141
|
+
if (it.current?.active) {
|
|
1142
|
+
const c = it.current.edgeId, i = it.current.movingEnd, p = it.current.fixedNodeId;
|
|
1143
|
+
it.current = null;
|
|
1144
|
+
const H = dt.current(g.global.x, g.global.y), N = X.current.nodes, z = ue ? Q(V.current?.state.zoom ?? 1, 12, 24) : 0;
|
|
1145
|
+
let C = null;
|
|
1146
|
+
for (let k = N.length - 1; k >= 0; k--) if (Vt(H.x, H.y, N[k], z) && N[k].id !== p) {
|
|
1147
|
+
C = N[k];
|
|
1148
1148
|
break;
|
|
1149
1149
|
}
|
|
1150
|
-
if (
|
|
1151
|
-
const
|
|
1152
|
-
tt((
|
|
1153
|
-
const
|
|
1154
|
-
return
|
|
1155
|
-
...
|
|
1150
|
+
if (C) {
|
|
1151
|
+
const k = C.id, o = Mt(C.width, C.height), x = Ft(o, C, H.x, H.y, 1 / 0)?.id;
|
|
1152
|
+
tt((l) => {
|
|
1153
|
+
const e = l.canvases[Z.current];
|
|
1154
|
+
return e ? {
|
|
1155
|
+
...l,
|
|
1156
1156
|
canvases: {
|
|
1157
|
-
...
|
|
1157
|
+
...l.canvases,
|
|
1158
1158
|
[Z.current]: {
|
|
1159
|
-
...
|
|
1160
|
-
edges:
|
|
1161
|
-
...
|
|
1162
|
-
source:
|
|
1163
|
-
sourceHandle:
|
|
1159
|
+
...e,
|
|
1160
|
+
edges: e.edges.map((w) => w.id !== c ? w : i === "source" ? {
|
|
1161
|
+
...w,
|
|
1162
|
+
source: k,
|
|
1163
|
+
sourceHandle: x
|
|
1164
1164
|
} : {
|
|
1165
|
-
...
|
|
1166
|
-
target:
|
|
1167
|
-
targetHandle:
|
|
1165
|
+
...w,
|
|
1166
|
+
target: k,
|
|
1167
|
+
targetHandle: x
|
|
1168
1168
|
})
|
|
1169
1169
|
}
|
|
1170
1170
|
}
|
|
1171
|
-
} :
|
|
1171
|
+
} : l;
|
|
1172
1172
|
});
|
|
1173
1173
|
}
|
|
1174
1174
|
return;
|
|
1175
1175
|
}
|
|
1176
1176
|
if (rt.current?.active) {
|
|
1177
|
-
const
|
|
1177
|
+
const c = rt.current.sourceNodeId, i = rt.current.sourceHandleId;
|
|
1178
1178
|
rt.current = null;
|
|
1179
|
-
const p = dt.current(
|
|
1180
|
-
let
|
|
1181
|
-
for (let
|
|
1182
|
-
|
|
1179
|
+
const p = dt.current(g.global.x, g.global.y), H = X.current.nodes, N = ue ? Q(V.current?.state.zoom ?? 1, 12, 24) : 0;
|
|
1180
|
+
let z = null;
|
|
1181
|
+
for (let C = H.length - 1; C >= 0; C--) if (Vt(p.x, p.y, H[C], N) && H[C].id !== c) {
|
|
1182
|
+
z = H[C];
|
|
1183
1183
|
break;
|
|
1184
1184
|
}
|
|
1185
|
-
if (
|
|
1186
|
-
const
|
|
1187
|
-
tt((
|
|
1188
|
-
const
|
|
1189
|
-
return !
|
|
1190
|
-
...
|
|
1185
|
+
if (z) {
|
|
1186
|
+
const C = z.id, k = Mt(z.width, z.height), o = Ft(k, z, p.x, p.y, 1 / 0)?.id, x = `edge_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`, l = $e.current;
|
|
1187
|
+
tt((e) => {
|
|
1188
|
+
const w = e.canvases[Z.current];
|
|
1189
|
+
return !w || w.edges.some((y) => y.source === c && y.target === C && y.sourceHandle === i && y.targetHandle === o) ? e : {
|
|
1190
|
+
...e,
|
|
1191
1191
|
canvases: {
|
|
1192
|
-
...
|
|
1192
|
+
...e.canvases,
|
|
1193
1193
|
[Z.current]: {
|
|
1194
|
-
...
|
|
1195
|
-
edges: [...
|
|
1196
|
-
id:
|
|
1197
|
-
source:
|
|
1198
|
-
target:
|
|
1199
|
-
sourceHandle:
|
|
1200
|
-
targetHandle:
|
|
1201
|
-
type:
|
|
1194
|
+
...w,
|
|
1195
|
+
edges: [...w.edges, {
|
|
1196
|
+
id: x,
|
|
1197
|
+
source: c,
|
|
1198
|
+
target: C,
|
|
1199
|
+
sourceHandle: i,
|
|
1200
|
+
targetHandle: o,
|
|
1201
|
+
type: l,
|
|
1202
1202
|
data: {
|
|
1203
1203
|
strokeColor: "theme:base-content",
|
|
1204
1204
|
strokeWidth: 2,
|
|
@@ -1213,144 +1213,144 @@ function fr({ onPixiReady: L }) {
|
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
1215
|
}), bt.on("pointerupoutside", () => {
|
|
1216
|
-
Pt(),
|
|
1216
|
+
Pt(), ct.current?.active && Ht.current(), ht.current?.active && Ht.current(), ct.current = null, ht.current = null, gt.current = null, nt.current = null, it.current = null, rt.current = null, ft.current = null, vt.current = null, kt.current = null, Gt.current = null, Wt.current = null, Tt.current?.hideMarquee();
|
|
1217
1217
|
});
|
|
1218
|
-
const At =
|
|
1219
|
-
let
|
|
1220
|
-
const
|
|
1221
|
-
const
|
|
1218
|
+
const At = R.current;
|
|
1219
|
+
let pt = null;
|
|
1220
|
+
const de = (g) => {
|
|
1221
|
+
const c = At.getBoundingClientRect(), i = g[0].clientX, p = g[0].clientY, H = g[1].clientX, N = g[1].clientY;
|
|
1222
1222
|
return {
|
|
1223
|
-
dist: Math.hypot(
|
|
1224
|
-
midX: (
|
|
1225
|
-
midY: (p +
|
|
1223
|
+
dist: Math.hypot(H - i, N - p),
|
|
1224
|
+
midX: (i + H) / 2 - c.left,
|
|
1225
|
+
midY: (p + N) / 2 - c.top
|
|
1226
1226
|
};
|
|
1227
|
-
},
|
|
1228
|
-
Pt(),
|
|
1229
|
-
},
|
|
1230
|
-
if (
|
|
1231
|
-
const
|
|
1232
|
-
|
|
1233
|
-
},
|
|
1234
|
-
if (!
|
|
1235
|
-
|
|
1236
|
-
const
|
|
1237
|
-
if (!
|
|
1238
|
-
const
|
|
1239
|
-
Number.isFinite(p) && p > 0 &&
|
|
1240
|
-
x:
|
|
1241
|
-
y:
|
|
1242
|
-
}),
|
|
1243
|
-
},
|
|
1244
|
-
if (
|
|
1245
|
-
|
|
1227
|
+
}, Pe = () => {
|
|
1228
|
+
Pt(), ct.current?.active && Ht.current(), ht.current?.active && Ht.current(), ct.current = null, ht.current = null, gt.current = null, nt.current = null, it.current = null, rt.current = null, ft.current = null, vt.current = null, kt.current = null, Gt.current = null, Wt.current = null, Tt.current?.hideMarquee(), V.current?.cancelPan();
|
|
1229
|
+
}, nn = (g) => {
|
|
1230
|
+
if (g.touches.length < 2) return;
|
|
1231
|
+
const c = V.current;
|
|
1232
|
+
c && (c.multiTouchActive = !0, Pe(), pt = de(g.touches), g.preventDefault());
|
|
1233
|
+
}, rn = (g) => {
|
|
1234
|
+
if (!pt || g.touches.length < 2) return;
|
|
1235
|
+
g.preventDefault();
|
|
1236
|
+
const c = V.current;
|
|
1237
|
+
if (!c) return;
|
|
1238
|
+
const i = de(g.touches), p = i.dist / Math.max(1, pt.dist);
|
|
1239
|
+
Number.isFinite(p) && p > 0 && c.zoomAt(i.midX, i.midY, p), c.setState({
|
|
1240
|
+
x: c.state.x + (i.midX - pt.midX),
|
|
1241
|
+
y: c.state.y + (i.midY - pt.midY)
|
|
1242
|
+
}), pt = i;
|
|
1243
|
+
}, Ae = (g) => {
|
|
1244
|
+
if (g.touches.length >= 2) {
|
|
1245
|
+
pt = de(g.touches);
|
|
1246
1246
|
return;
|
|
1247
1247
|
}
|
|
1248
|
-
if (
|
|
1249
|
-
const
|
|
1250
|
-
|
|
1248
|
+
if (pt = null, g.touches.length === 0) {
|
|
1249
|
+
const c = V.current;
|
|
1250
|
+
c && (c.multiTouchActive = !1), qe.current = performance.now() + 350;
|
|
1251
1251
|
}
|
|
1252
1252
|
};
|
|
1253
|
-
At?.addEventListener("touchstart",
|
|
1254
|
-
if (
|
|
1255
|
-
const
|
|
1253
|
+
At?.addEventListener("touchstart", nn, { passive: !1 }), At?.addEventListener("touchmove", rn, { passive: !1 }), At?.addEventListener("touchend", Ae), At?.addEventListener("touchcancel", Ae), O = nn, W = rn, K = Ae, bt.on("rightclick", (g) => {
|
|
1254
|
+
if (g.preventDefault?.(), V.current?.didRightPan) return;
|
|
1255
|
+
const c = dt.current(g.global.x, g.global.y), i = X.current.nodes;
|
|
1256
1256
|
let p = null;
|
|
1257
|
-
for (let
|
|
1258
|
-
p =
|
|
1257
|
+
for (let C = i.length - 1; C >= 0; C--) if (Vt(c.x, c.y, i[C])) {
|
|
1258
|
+
p = i[C].id;
|
|
1259
1259
|
break;
|
|
1260
1260
|
}
|
|
1261
|
-
const
|
|
1262
|
-
|
|
1263
|
-
x:
|
|
1264
|
-
y:
|
|
1261
|
+
const H = g.nativeEvent, N = H?.clientX ?? g.global.x, z = H?.clientY ?? g.global.y;
|
|
1262
|
+
ye({
|
|
1263
|
+
x: N,
|
|
1264
|
+
y: z,
|
|
1265
1265
|
nodeId: p
|
|
1266
1266
|
});
|
|
1267
|
-
}), bt.on("pointertap", (
|
|
1268
|
-
if (
|
|
1269
|
-
const
|
|
1267
|
+
}), bt.on("pointertap", (g) => {
|
|
1268
|
+
if (V.current?.multiTouchActive || performance.now() < qe.current || g.button !== 0) return;
|
|
1269
|
+
const c = Date.now(), i = dt.current(g.global.x, g.global.y), p = ie.current;
|
|
1270
1270
|
if (p) {
|
|
1271
|
-
const
|
|
1271
|
+
const C = kn("node"), k = Nt.current, o = Jt.current, x = Zt(i.x - p.width / 2, k, o), l = Zt(i.y - p.height / 2, k, o), e = {
|
|
1272
1272
|
id: "__ghost__",
|
|
1273
1273
|
type: p.type,
|
|
1274
1274
|
position: {
|
|
1275
|
-
x
|
|
1275
|
+
x,
|
|
1276
1276
|
y: l
|
|
1277
1277
|
},
|
|
1278
1278
|
width: p.width,
|
|
1279
1279
|
height: p.height,
|
|
1280
1280
|
data: {}
|
|
1281
|
-
}], X.current.nodes),
|
|
1282
|
-
tt((
|
|
1283
|
-
const
|
|
1284
|
-
if (!
|
|
1285
|
-
const
|
|
1286
|
-
p.type === "animAnchor" && (
|
|
1287
|
-
const
|
|
1281
|
+
}, w = ve([e], X.current.nodes), y = x + w.dx, E = l + w.dy;
|
|
1282
|
+
tt((t) => {
|
|
1283
|
+
const r = t.canvases[Z.current];
|
|
1284
|
+
if (!r) return t;
|
|
1285
|
+
const a = {};
|
|
1286
|
+
p.type === "animAnchor" && (a.animIndex = Xn(t));
|
|
1287
|
+
const d = Math.max(0, ...r.nodes.map((n) => n.zIndex ?? 0), ...r.lines.map((n) => n.zIndex ?? 0));
|
|
1288
1288
|
return {
|
|
1289
|
-
...
|
|
1289
|
+
...t,
|
|
1290
1290
|
canvases: {
|
|
1291
|
-
...
|
|
1291
|
+
...t.canvases,
|
|
1292
1292
|
[Z.current]: {
|
|
1293
|
-
...
|
|
1294
|
-
nodes: [...
|
|
1295
|
-
id:
|
|
1293
|
+
...r,
|
|
1294
|
+
nodes: [...r.nodes, {
|
|
1295
|
+
id: C,
|
|
1296
1296
|
type: p.type,
|
|
1297
1297
|
position: {
|
|
1298
|
-
x:
|
|
1299
|
-
y
|
|
1298
|
+
x: y,
|
|
1299
|
+
y: E
|
|
1300
1300
|
},
|
|
1301
1301
|
width: p.width,
|
|
1302
1302
|
height: p.height,
|
|
1303
|
-
zIndex:
|
|
1303
|
+
zIndex: d + 1,
|
|
1304
1304
|
data: {
|
|
1305
1305
|
...p.data,
|
|
1306
|
-
...
|
|
1306
|
+
...a
|
|
1307
1307
|
}
|
|
1308
1308
|
}]
|
|
1309
1309
|
}
|
|
1310
1310
|
}
|
|
1311
1311
|
};
|
|
1312
|
-
}),
|
|
1313
|
-
nodeIds: /* @__PURE__ */ new Set([
|
|
1312
|
+
}), xt({
|
|
1313
|
+
nodeIds: /* @__PURE__ */ new Set([C]),
|
|
1314
1314
|
edgeIds: /* @__PURE__ */ new Set(),
|
|
1315
1315
|
lineIds: /* @__PURE__ */ new Set()
|
|
1316
|
-
}),
|
|
1317
|
-
ce.current(
|
|
1316
|
+
}), se.current && window.setTimeout(() => {
|
|
1317
|
+
ce.current(y, E, p.width, p.height, {
|
|
1318
1318
|
padding: 80,
|
|
1319
1319
|
preserveZoom: !0,
|
|
1320
1320
|
duration: 280
|
|
1321
1321
|
});
|
|
1322
|
-
}, 0),
|
|
1322
|
+
}, 0), Yt.current = {
|
|
1323
1323
|
time: 0,
|
|
1324
1324
|
wx: 0,
|
|
1325
1325
|
wy: 0
|
|
1326
1326
|
};
|
|
1327
1327
|
return;
|
|
1328
1328
|
}
|
|
1329
|
-
const
|
|
1330
|
-
if (
|
|
1331
|
-
const
|
|
1332
|
-
for (let l =
|
|
1333
|
-
const e =
|
|
1334
|
-
if (
|
|
1335
|
-
|
|
1329
|
+
const H = Yt.current, N = i.x - H.wx, z = i.y - H.wy;
|
|
1330
|
+
if (c - H.time < 400 && Math.abs(N) < 10 && Math.abs(z) < 10) {
|
|
1331
|
+
const C = X.current.nodes;
|
|
1332
|
+
for (let l = C.length - 1; l >= 0; l--) if (Vt(i.x, i.y, C[l])) {
|
|
1333
|
+
const e = C[l], w = e.data.childCanvasId;
|
|
1334
|
+
if (w) {
|
|
1335
|
+
bn(w), Yt.current = {
|
|
1336
1336
|
time: 0,
|
|
1337
1337
|
wx: 0,
|
|
1338
1338
|
wy: 0
|
|
1339
1339
|
};
|
|
1340
1340
|
return;
|
|
1341
1341
|
}
|
|
1342
|
-
|
|
1342
|
+
me.current("node", e.id, e.data.label ?? ""), Yt.current = {
|
|
1343
1343
|
time: 0,
|
|
1344
1344
|
wx: 0,
|
|
1345
1345
|
wy: 0
|
|
1346
1346
|
};
|
|
1347
1347
|
return;
|
|
1348
1348
|
}
|
|
1349
|
-
const
|
|
1350
|
-
for (const l of
|
|
1351
|
-
const
|
|
1352
|
-
for (let l =
|
|
1353
|
-
|
|
1349
|
+
const k = X.current.edges, o = /* @__PURE__ */ new Map();
|
|
1350
|
+
for (const l of C) o.set(l.id, l);
|
|
1351
|
+
const x = V.current?.state.zoom ?? 1;
|
|
1352
|
+
for (let l = k.length - 1; l >= 0; l--) if (Le(i.x, i.y, k[l], o, Q(x, 8, 12))) {
|
|
1353
|
+
me.current("edge", k[l].id, k[l].data.labelText ?? ""), Yt.current = {
|
|
1354
1354
|
time: 0,
|
|
1355
1355
|
wx: 0,
|
|
1356
1356
|
wy: 0
|
|
@@ -1358,66 +1358,66 @@ function fr({ onPixiReady: L }) {
|
|
|
1358
1358
|
return;
|
|
1359
1359
|
}
|
|
1360
1360
|
}
|
|
1361
|
-
|
|
1362
|
-
time:
|
|
1363
|
-
wx:
|
|
1364
|
-
wy:
|
|
1361
|
+
Yt.current = {
|
|
1362
|
+
time: c,
|
|
1363
|
+
wx: i.x,
|
|
1364
|
+
wy: i.y
|
|
1365
1365
|
};
|
|
1366
1366
|
});
|
|
1367
|
-
let
|
|
1368
|
-
f.app.ticker.add((
|
|
1367
|
+
let on = !1;
|
|
1368
|
+
f.app.ticker.add((g) => {
|
|
1369
1369
|
if (f.destroyed) return;
|
|
1370
|
-
const
|
|
1370
|
+
const c = g.deltaMS, i = f.app.screen, p = V.current?.state ?? {
|
|
1371
1371
|
x: 0,
|
|
1372
1372
|
y: 0,
|
|
1373
1373
|
zoom: 1
|
|
1374
1374
|
};
|
|
1375
|
-
|
|
1376
|
-
const
|
|
1377
|
-
|
|
1378
|
-
const
|
|
1379
|
-
|
|
1380
|
-
const
|
|
1381
|
-
|
|
1382
|
-
showAnchors:
|
|
1375
|
+
D.current?.update(p, i.width, i.height);
|
|
1376
|
+
const H = V.current?.isPanning ?? !1;
|
|
1377
|
+
H !== on && (on = H, R.current && (R.current.style.cursor = H ? "grabbing" : ""));
|
|
1378
|
+
const N = X.current, z = re.current, C = Yn(Ue.current), k = /* @__PURE__ */ new Map();
|
|
1379
|
+
C.forEach((t, r) => k.set(t.node.id, r + 1)), pe.current?.advanceAnimation(c);
|
|
1380
|
+
const o = Dt.current ? C[Dt.current.current] : void 0;
|
|
1381
|
+
pe.current?.sync(N.nodes, z.nodeIds, kt.current, k, {
|
|
1382
|
+
showAnchors: je.current,
|
|
1383
1383
|
presentation: Dt.current !== null,
|
|
1384
|
-
presentationAnchorId:
|
|
1384
|
+
presentationAnchorId: o?.node.id,
|
|
1385
1385
|
presentationAnchorVisible: Dt.current?.showAnchor ?? !1
|
|
1386
1386
|
});
|
|
1387
|
-
const
|
|
1388
|
-
for (const t of
|
|
1389
|
-
|
|
1390
|
-
const l =
|
|
1387
|
+
const x = /* @__PURE__ */ new Map();
|
|
1388
|
+
for (const t of N.nodes) x.set(t.id, t);
|
|
1389
|
+
xe.current?.advanceAnimation(c), xe.current?.sync(N.edges, x, z.edgeIds, null, { presentation: Dt.current !== null }), ge.current?.advanceAnimation(c), ge.current?.sync(N.lines, z.lineIds), we.current?.update(Lt.current, i.width, i.height, p);
|
|
1390
|
+
const l = Be.current;
|
|
1391
1391
|
if (l) {
|
|
1392
|
-
const t = (
|
|
1393
|
-
let
|
|
1392
|
+
const t = (z.nodeIds.size > 0 || z.edgeIds.size > 0 || z.lineIds.size > 0) && !jt.current && !Dt.current && !ie.current;
|
|
1393
|
+
let r = !t;
|
|
1394
1394
|
if (t) {
|
|
1395
|
-
let a = 1 / 0,
|
|
1396
|
-
const
|
|
1397
|
-
a = Math.min(a,
|
|
1395
|
+
let a = 1 / 0, d = 1 / 0, n = -1 / 0, s = -1 / 0;
|
|
1396
|
+
const m = (h, I, S, u) => {
|
|
1397
|
+
a = Math.min(a, h), d = Math.min(d, I), n = Math.max(n, h + S), s = Math.max(s, I + u);
|
|
1398
1398
|
};
|
|
1399
|
-
for (const
|
|
1400
|
-
for (const
|
|
1401
|
-
if (!
|
|
1402
|
-
const
|
|
1403
|
-
|
|
1399
|
+
for (const h of N.nodes) z.nodeIds.has(h.id) && m(h.position.x, h.position.y, h.width, h.height);
|
|
1400
|
+
for (const h of N.edges) {
|
|
1401
|
+
if (!z.edgeIds.has(h.id)) continue;
|
|
1402
|
+
const I = x.get(h.source), S = x.get(h.target);
|
|
1403
|
+
I && m(I.position.x, I.position.y, I.width, I.height), S && m(S.position.x, S.position.y, S.width, S.height);
|
|
1404
1404
|
}
|
|
1405
|
-
for (const
|
|
1406
|
-
if (
|
|
1407
|
-
for (const
|
|
1408
|
-
if (a === 1 / 0)
|
|
1405
|
+
for (const h of N.lines)
|
|
1406
|
+
if (z.lineIds.has(h.id))
|
|
1407
|
+
for (const I of h.points) m(I.x, I.y, 0, 0);
|
|
1408
|
+
if (a === 1 / 0) r = !0;
|
|
1409
1409
|
else {
|
|
1410
|
-
const
|
|
1411
|
-
let b = n *
|
|
1412
|
-
b +
|
|
1410
|
+
const h = p.zoom, I = 66, S = 30, u = 6;
|
|
1411
|
+
let b = n * h + p.x + 8, _ = d * h + p.y - S - 6;
|
|
1412
|
+
b + I > i.width - u && (b = Math.max(u, i.width - I - u)), _ < u && (_ = d * h + p.y + u), _ + S > i.height - u && (_ = Math.max(u, i.height - S - u)), l.style.display = "flex", l.style.left = `${Math.round(b)}px`, l.style.top = `${Math.round(_)}px`;
|
|
1413
1413
|
}
|
|
1414
1414
|
}
|
|
1415
|
-
|
|
1415
|
+
r && l.style.display !== "none" && (l.style.display = "none");
|
|
1416
1416
|
}
|
|
1417
|
-
const e =
|
|
1417
|
+
const e = te.current;
|
|
1418
1418
|
if (e) {
|
|
1419
1419
|
e.clear();
|
|
1420
|
-
const t =
|
|
1420
|
+
const t = Gt.current;
|
|
1421
1421
|
t && (e.circle(t.wx, t.wy, 10).fill({
|
|
1422
1422
|
color: 3900150,
|
|
1423
1423
|
alpha: 0.12
|
|
@@ -1429,36 +1429,36 @@ function fr({ onPixiReady: L }) {
|
|
|
1429
1429
|
color: 3900150,
|
|
1430
1430
|
alpha: 0.9
|
|
1431
1431
|
}));
|
|
1432
|
-
const
|
|
1433
|
-
|
|
1432
|
+
const r = Wt.current;
|
|
1433
|
+
r && !t && (e.circle(r.worldX, r.worldY, 10).fill({
|
|
1434
1434
|
color: 16347926,
|
|
1435
1435
|
alpha: 0.12
|
|
1436
1436
|
}).stroke({
|
|
1437
1437
|
color: 16347926,
|
|
1438
1438
|
width: 1.5,
|
|
1439
1439
|
alpha: 0.5
|
|
1440
|
-
}), e.circle(
|
|
1440
|
+
}), e.circle(r.worldX, r.worldY, 4).fill({
|
|
1441
1441
|
color: 16347926,
|
|
1442
1442
|
alpha: 0.9
|
|
1443
1443
|
}));
|
|
1444
1444
|
}
|
|
1445
|
-
const
|
|
1446
|
-
if (
|
|
1447
|
-
|
|
1448
|
-
const t =
|
|
1445
|
+
const w = ne.current;
|
|
1446
|
+
if (w) {
|
|
1447
|
+
w.clear();
|
|
1448
|
+
const t = ie.current;
|
|
1449
1449
|
if (t) {
|
|
1450
|
-
const
|
|
1450
|
+
const r = Ze.current, a = Nt.current, d = Jt.current, n = Zt(r.x - t.width / 2, a, d), s = Zt(r.y - t.height / 2, a, d), m = {
|
|
1451
1451
|
id: "__ghost__",
|
|
1452
1452
|
type: t.type,
|
|
1453
1453
|
position: {
|
|
1454
1454
|
x: n,
|
|
1455
|
-
y:
|
|
1455
|
+
y: s
|
|
1456
1456
|
},
|
|
1457
1457
|
width: t.width,
|
|
1458
1458
|
height: t.height,
|
|
1459
1459
|
data: {}
|
|
1460
|
-
}],
|
|
1461
|
-
|
|
1460
|
+
}, h = ve([m], N.nodes);
|
|
1461
|
+
Lt.current = h.guides, w.position.set(n + h.dx, s + h.dy), (ln[t.type] ?? ln.shapeRect)(w, {
|
|
1462
1462
|
width: t.width,
|
|
1463
1463
|
height: t.height,
|
|
1464
1464
|
fill: "#3b82f6",
|
|
@@ -1467,14 +1467,14 @@ function fr({ onPixiReady: L }) {
|
|
|
1467
1467
|
borderStyle: t.data.borderStyle
|
|
1468
1468
|
});
|
|
1469
1469
|
} else
|
|
1470
|
-
|
|
1470
|
+
w.position.set(0, 0), !ct.current?.active && !gt.current?.active && (Lt.current = []);
|
|
1471
1471
|
}
|
|
1472
|
-
const y =
|
|
1473
|
-
if (y && (y.clear(),
|
|
1472
|
+
const y = ee.current;
|
|
1473
|
+
if (y && (y.clear(), z.edgeIds.size > 0 && oe.current === "select")) {
|
|
1474
1474
|
const t = 1 / p.zoom;
|
|
1475
|
-
for (const
|
|
1476
|
-
if (!
|
|
1477
|
-
const a = St(
|
|
1475
|
+
for (const r of N.edges) {
|
|
1476
|
+
if (!z.edgeIds.has(r.id)) continue;
|
|
1477
|
+
const a = St(r, x);
|
|
1478
1478
|
a && (y.circle(a.sx, a.sy, 5 * t).fill({ color: 16777215 }).stroke({
|
|
1479
1479
|
color: 16347926,
|
|
1480
1480
|
width: 1.5 * t
|
|
@@ -1482,39 +1482,39 @@ function fr({ onPixiReady: L }) {
|
|
|
1482
1482
|
color: 16347926,
|
|
1483
1483
|
width: 1.5 * t
|
|
1484
1484
|
}));
|
|
1485
|
-
const
|
|
1486
|
-
if (
|
|
1485
|
+
const d = r.data.waypoints;
|
|
1486
|
+
if (d) for (const n of d) y.circle(n.x, n.y, 5 * t).fill({ color: 16777215 }).stroke({
|
|
1487
1487
|
color: 3900150,
|
|
1488
1488
|
width: 1.5 * t
|
|
1489
1489
|
});
|
|
1490
|
-
if (
|
|
1491
|
-
const n = St(
|
|
1490
|
+
if (r.type === "simplebezier") {
|
|
1491
|
+
const n = St(r, x);
|
|
1492
1492
|
if (!n) continue;
|
|
1493
|
-
const
|
|
1493
|
+
const s = d ?? [], m = [
|
|
1494
1494
|
{
|
|
1495
1495
|
x: n.sx,
|
|
1496
1496
|
y: n.sy
|
|
1497
1497
|
},
|
|
1498
|
-
...
|
|
1498
|
+
...s,
|
|
1499
1499
|
{
|
|
1500
1500
|
x: n.tx,
|
|
1501
1501
|
y: n.ty
|
|
1502
1502
|
}
|
|
1503
|
-
],
|
|
1504
|
-
for (let
|
|
1505
|
-
const u =
|
|
1506
|
-
y.moveTo(u.x, u.y).lineTo(
|
|
1503
|
+
], h = r.data.bezierControls, I = m.length - 2;
|
|
1504
|
+
for (let S = 0; S <= I; S++) {
|
|
1505
|
+
const u = m[S], b = m[S + 1], _ = h?.[S], J = Math.hypot(b.x - u.x, b.y - u.y), _t = Math.max(30, J * 0.3), Ot = _?.c1x ?? (S === 0 ? u.x + n.snx * _t : u.x + (b.x - u.x) * 0.4), sn = _?.c1y ?? (S === 0 ? u.y + n.sny * _t : u.y), cn = _?.c2x ?? (S === I ? b.x + n.tnx * _t : b.x - (b.x - u.x) * 0.4), dn = _?.c2y ?? (S === I ? b.y + n.tny * _t : b.y);
|
|
1506
|
+
y.moveTo(u.x, u.y).lineTo(Ot, sn).stroke({
|
|
1507
1507
|
color: 10265519,
|
|
1508
1508
|
width: 1 * t
|
|
1509
|
-
}), y.moveTo(b.x, b.y).lineTo(
|
|
1509
|
+
}), y.moveTo(b.x, b.y).lineTo(cn, dn).stroke({
|
|
1510
1510
|
color: 10265519,
|
|
1511
1511
|
width: 1 * t
|
|
1512
1512
|
});
|
|
1513
|
-
const
|
|
1514
|
-
y.circle(
|
|
1513
|
+
const an = 4 * t;
|
|
1514
|
+
y.circle(Ot, sn, an).fill({ color: 16777215 }).stroke({
|
|
1515
1515
|
color: 3900150,
|
|
1516
1516
|
width: 1.5 * t
|
|
1517
|
-
}), y.circle(
|
|
1517
|
+
}), y.circle(cn, dn, an).fill({ color: 16777215 }).stroke({
|
|
1518
1518
|
color: 3900150,
|
|
1519
1519
|
width: 1.5 * t
|
|
1520
1520
|
});
|
|
@@ -1522,62 +1522,62 @@ function fr({ onPixiReady: L }) {
|
|
|
1522
1522
|
}
|
|
1523
1523
|
}
|
|
1524
1524
|
}
|
|
1525
|
-
const
|
|
1526
|
-
if (
|
|
1527
|
-
const t = [...
|
|
1528
|
-
if (
|
|
1529
|
-
const a = p.zoom,
|
|
1530
|
-
|
|
1525
|
+
const E = Qt.current;
|
|
1526
|
+
if (E && (E.clear(), z.nodeIds.size === 1 && oe.current === "select")) {
|
|
1527
|
+
const t = [...z.nodeIds][0], r = N.nodes.find((a) => a.id === t);
|
|
1528
|
+
if (r) {
|
|
1529
|
+
const a = p.zoom, d = r.position.x * a + p.x, n = r.position.y * a + p.y, s = r.width * a, m = r.height * a;
|
|
1530
|
+
E.rect(d, n, s, m).stroke({
|
|
1531
1531
|
color: 3900150,
|
|
1532
1532
|
width: 1.5
|
|
1533
1533
|
});
|
|
1534
|
-
const
|
|
1535
|
-
[
|
|
1536
|
-
[
|
|
1537
|
-
[
|
|
1538
|
-
[
|
|
1534
|
+
const h = 7, I = h / 2, S = [
|
|
1535
|
+
[d, n],
|
|
1536
|
+
[d + s, n],
|
|
1537
|
+
[d + s, n + m],
|
|
1538
|
+
[d, n + m]
|
|
1539
1539
|
];
|
|
1540
|
-
for (const [_, J] of
|
|
1540
|
+
for (const [_, J] of S) E.rect(_ - I, J - I, h, h).fill({ color: 16777215 }).stroke({
|
|
1541
1541
|
color: 3900150,
|
|
1542
1542
|
width: 1.5
|
|
1543
1543
|
});
|
|
1544
1544
|
const u = 4, b = [
|
|
1545
|
-
[
|
|
1546
|
-
[
|
|
1547
|
-
[
|
|
1548
|
-
[
|
|
1545
|
+
[d + s / 2, n],
|
|
1546
|
+
[d + s, n + m / 2],
|
|
1547
|
+
[d + s / 2, n + m],
|
|
1548
|
+
[d, n + m / 2]
|
|
1549
1549
|
];
|
|
1550
|
-
for (const [_, J] of b)
|
|
1550
|
+
for (const [_, J] of b) E.circle(_, J, u).fill({
|
|
1551
1551
|
color: 3900150,
|
|
1552
1552
|
alpha: 0.9
|
|
1553
1553
|
});
|
|
1554
|
-
if (!
|
|
1555
|
-
const _ =
|
|
1556
|
-
|
|
1554
|
+
if (!jt.current) {
|
|
1555
|
+
const _ = d + s / 2, J = n - In;
|
|
1556
|
+
E.moveTo(_, n).lineTo(_, J).stroke({
|
|
1557
1557
|
color: 3900150,
|
|
1558
1558
|
width: 1.5,
|
|
1559
1559
|
alpha: 0.85
|
|
1560
|
-
}),
|
|
1560
|
+
}), E.circle(_, J, 6).fill({ color: 16777215 }).stroke({
|
|
1561
1561
|
color: 3900150,
|
|
1562
1562
|
width: 1.5
|
|
1563
|
-
}),
|
|
1563
|
+
}), E.circle(_, J, 2.5).fill({ color: 3900150 });
|
|
1564
1564
|
}
|
|
1565
1565
|
}
|
|
1566
1566
|
}
|
|
1567
1567
|
});
|
|
1568
1568
|
};
|
|
1569
|
-
return
|
|
1569
|
+
return q(), () => {
|
|
1570
1570
|
if (G = !0, f && !f.destroyed) try {
|
|
1571
1571
|
f.app.stage.removeAllListeners();
|
|
1572
1572
|
} catch {
|
|
1573
1573
|
}
|
|
1574
|
-
const
|
|
1575
|
-
|
|
1574
|
+
const F = R.current;
|
|
1575
|
+
O && F?.removeEventListener("touchstart", O), W && F?.removeEventListener("touchmove", W), K && (F?.removeEventListener("touchend", K), F?.removeEventListener("touchcancel", K)), D.current?.destroy(), Tt.current?.destroy(), pe.current?.destroy(), xe.current?.destroy(), ge.current?.destroy(), Re.current?.destroy(), Se.current?.destroy(), mt.current?.destroy(), Qt.current && (Qt.current.destroy(), Qt.current = null), te.current && (te.current.destroy(), te.current = null), ee.current && (ee.current.destroy(), ee.current = null), ne.current && (ne.current.destroy(), ne.current = null), we.current?.destroy();
|
|
1576
1576
|
};
|
|
1577
|
-
}, [
|
|
1578
|
-
const f =
|
|
1577
|
+
}, [L.current]), Rt(() => {
|
|
1578
|
+
const f = Re.current, G = Se.current;
|
|
1579
1579
|
if (!(!f || !G))
|
|
1580
|
-
switch (f.deactivate(), G.deactivate(),
|
|
1580
|
+
switch (f.deactivate(), G.deactivate(), et) {
|
|
1581
1581
|
case "freehand":
|
|
1582
1582
|
f.activate();
|
|
1583
1583
|
break;
|
|
@@ -1589,68 +1589,67 @@ function fr({ onPixiReady: L }) {
|
|
|
1589
1589
|
break;
|
|
1590
1590
|
case "arrow":
|
|
1591
1591
|
G.activate("arrow");
|
|
1592
|
-
break;
|
|
1593
1592
|
}
|
|
1594
|
-
}, [
|
|
1595
|
-
|
|
1596
|
-
}, [
|
|
1597
|
-
const f =
|
|
1593
|
+
}, [et]), Rt(() => {
|
|
1594
|
+
D.current && (D.current.visible = ut, D.current.gridSize = $);
|
|
1595
|
+
}, [ut, $]), Rt(() => {
|
|
1596
|
+
const f = R.current;
|
|
1598
1597
|
if (!f) return;
|
|
1599
|
-
const G = 1e-3,
|
|
1600
|
-
|
|
1601
|
-
const K =
|
|
1598
|
+
const G = 1e-3, O = (W) => {
|
|
1599
|
+
W.preventDefault();
|
|
1600
|
+
const K = V.current;
|
|
1602
1601
|
if (!K) return;
|
|
1603
|
-
const
|
|
1604
|
-
K.zoomAt(
|
|
1602
|
+
const q = f.getBoundingClientRect(), F = W.clientX - q.left, at = W.clientY - q.top, lt = W.ctrlKey ? 3 : 1, It = -W.deltaY * G * lt;
|
|
1603
|
+
K.zoomAt(F, at, 1 + It);
|
|
1605
1604
|
};
|
|
1606
|
-
return f.addEventListener("wheel",
|
|
1607
|
-
}, [
|
|
1605
|
+
return f.addEventListener("wheel", O, { passive: !1 }), () => f.removeEventListener("wheel", O);
|
|
1606
|
+
}, [V]), /* @__PURE__ */ Ie("div", {
|
|
1608
1607
|
style: {
|
|
1609
1608
|
position: "relative",
|
|
1610
1609
|
width: "100%",
|
|
1611
1610
|
height: "100%"
|
|
1612
1611
|
},
|
|
1613
1612
|
children: [
|
|
1614
|
-
/* @__PURE__ */
|
|
1615
|
-
ref:
|
|
1613
|
+
/* @__PURE__ */ qt("div", {
|
|
1614
|
+
ref: R,
|
|
1616
1615
|
className: "flow-canvas-wrapper",
|
|
1617
1616
|
tabIndex: -1,
|
|
1618
1617
|
onContextMenu: (f) => f.preventDefault()
|
|
1619
1618
|
}),
|
|
1620
|
-
|
|
1619
|
+
yt && Te && /* @__PURE__ */ qt("input", {
|
|
1621
1620
|
className: "flow-label-editor",
|
|
1622
1621
|
autoFocus: !0,
|
|
1623
|
-
defaultValue:
|
|
1622
|
+
defaultValue: yt.value,
|
|
1624
1623
|
style: {
|
|
1625
|
-
left:
|
|
1626
|
-
top:
|
|
1624
|
+
left: Te.x,
|
|
1625
|
+
top: Te.y
|
|
1627
1626
|
},
|
|
1628
1627
|
onFocus: (f) => f.currentTarget.select(),
|
|
1629
1628
|
onKeyDown: (f) => {
|
|
1630
|
-
f.key === "Enter" ? (f.preventDefault(),
|
|
1629
|
+
f.key === "Enter" ? (f.preventDefault(), Qe(f.target.value)) : f.key === "Escape" && (f.preventDefault(), Rn()), f.stopPropagation();
|
|
1631
1630
|
},
|
|
1632
|
-
onBlur: (f) =>
|
|
1631
|
+
onBlur: (f) => Qe(f.target.value),
|
|
1633
1632
|
onPointerDown: (f) => f.stopPropagation()
|
|
1634
1633
|
}),
|
|
1635
|
-
|
|
1634
|
+
wt && !Ct && /* @__PURE__ */ Ie("button", {
|
|
1636
1635
|
type: "button",
|
|
1637
1636
|
className: "flow-esc-button",
|
|
1638
|
-
onClick: () =>
|
|
1637
|
+
onClick: () => he(null),
|
|
1639
1638
|
title: "取消连续放置 (Esc)",
|
|
1640
|
-
children: [/* @__PURE__ */
|
|
1639
|
+
children: [/* @__PURE__ */ qt("span", {
|
|
1641
1640
|
"aria-hidden": !0,
|
|
1642
1641
|
children: "⎋"
|
|
1643
1642
|
}), " 取消放置 (ESC)"]
|
|
1644
1643
|
}),
|
|
1645
|
-
/* @__PURE__ */
|
|
1646
|
-
ref:
|
|
1644
|
+
/* @__PURE__ */ Ie("button", {
|
|
1645
|
+
ref: Be,
|
|
1647
1646
|
type: "button",
|
|
1648
1647
|
className: "flow-delete-button",
|
|
1649
1648
|
style: { display: "none" },
|
|
1650
|
-
onClick: () =>
|
|
1649
|
+
onClick: () => Fe.current(),
|
|
1651
1650
|
title: "删除所选 (Delete)",
|
|
1652
1651
|
"aria-label": "删除所选",
|
|
1653
|
-
children: [/* @__PURE__ */
|
|
1652
|
+
children: [/* @__PURE__ */ Ie("svg", {
|
|
1654
1653
|
width: "12",
|
|
1655
1654
|
height: "12",
|
|
1656
1655
|
viewBox: "0 0 24 24",
|
|
@@ -1661,9 +1660,9 @@ function fr({ onPixiReady: L }) {
|
|
|
1661
1660
|
strokeLinejoin: "round",
|
|
1662
1661
|
"aria-hidden": !0,
|
|
1663
1662
|
children: [
|
|
1664
|
-
/* @__PURE__ */
|
|
1665
|
-
/* @__PURE__ */
|
|
1666
|
-
/* @__PURE__ */
|
|
1663
|
+
/* @__PURE__ */ qt("path", { d: "M3 6h18" }),
|
|
1664
|
+
/* @__PURE__ */ qt("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }),
|
|
1665
|
+
/* @__PURE__ */ qt("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
|
|
1667
1666
|
]
|
|
1668
1667
|
}), "删除"]
|
|
1669
1668
|
})
|
|
@@ -1671,7 +1670,7 @@ function fr({ onPixiReady: L }) {
|
|
|
1671
1670
|
});
|
|
1672
1671
|
}
|
|
1673
1672
|
export {
|
|
1674
|
-
|
|
1673
|
+
yr as default
|
|
1675
1674
|
};
|
|
1676
1675
|
|
|
1677
1676
|
//# sourceMappingURL=FlowCanvas.js.map
|