@react-fabric/graph 1.0.0-beta.63 → 1.0.2
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/cjs/context/context.js +16 -0
- package/dist/cjs/graph/index.js +58 -381
- package/dist/cjs/index.js +25 -21
- package/dist/cjs/utils/edge.js +76 -0
- package/dist/cjs/utils/node.js +93 -0
- package/dist/cjs/utils/sdfFolder.js +107 -0
- package/dist/cjs/viewer/Graph.js +174 -0
- package/dist/esm/context/context.js +15 -0
- package/dist/esm/graph/index.js +59 -382
- package/dist/esm/index.js +24 -20
- package/dist/esm/utils/edge.js +75 -0
- package/dist/esm/utils/node.js +92 -0
- package/dist/esm/utils/sdfFolder.js +107 -0
- package/dist/esm/viewer/Graph.js +174 -0
- package/dist/types/context/context.d.ts +35 -0
- package/dist/types/graph/index.d.ts +47 -24
- package/dist/types/index.d.ts +28 -2
- package/dist/types/types/index.d.ts +124 -175
- package/dist/types/utils/edge.d.ts +28 -0
- package/dist/types/utils/node.d.ts +28 -0
- package/dist/types/utils/sdfFolder.d.ts +75 -0
- package/dist/types/viewer/Graph.d.ts +31 -0
- package/package.json +19 -25
- package/src/context/context.tsx +43 -0
- package/src/graph/index.ts +76 -399
- package/src/index.ts +24 -26
- package/src/types/index.ts +139 -185
- package/src/utils/edge.ts +65 -0
- package/src/utils/node.ts +105 -0
- package/src/utils/sdfFolder.ts +141 -0
- package/src/viewer/Graph.tsx +159 -0
- package/css/styles.css +0 -56
- package/dist/cjs/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +0 -14
- package/dist/cjs/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +0 -9
- package/dist/cjs/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +0 -35
- package/dist/cjs/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +0 -11
- package/dist/cjs/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +0 -20
- package/dist/cjs/_virtual/elk-worker.js +0 -8
- package/dist/cjs/components/ContextMenu.js +0 -133
- package/dist/cjs/components/Provider.js +0 -103
- package/dist/cjs/components/Tools.js +0 -205
- package/dist/cjs/components/Viewer.js +0 -59
- package/dist/cjs/components/context.js +0 -34
- package/dist/cjs/constants/index.js +0 -16
- package/dist/cjs/hooks/sigmaDragSelect.js +0 -169
- package/dist/cjs/hooks/sigmaHilighter.js +0 -83
- package/dist/cjs/hooks/sigmaMouseActions.js +0 -145
- package/dist/cjs/hooks/useGraphology.js +0 -41
- package/dist/cjs/hooks/useSigma.js +0 -112
- package/dist/cjs/programs/arrow-head/frag.glsl.js +0 -8
- package/dist/cjs/programs/arrow-head/index.js +0 -142
- package/dist/cjs/programs/arrow-head/vert.glsl.js +0 -8
- package/dist/cjs/programs/edge-curve/drawLabel.js +0 -136
- package/dist/cjs/programs/edge-curve/frag.glsl.js +0 -8
- package/dist/cjs/programs/edge-curve/index.js +0 -157
- package/dist/cjs/programs/edge-curve/vert.glsl.js +0 -8
- package/dist/cjs/programs/edge-line/drawLabel.js +0 -70
- package/dist/cjs/programs/edge-line/frag.glsl.js +0 -8
- package/dist/cjs/programs/edge-line/index.js +0 -166
- package/dist/cjs/programs/edge-line/vert.glsl.js +0 -8
- package/dist/cjs/programs/node-badge/factory.js +0 -250
- package/dist/cjs/programs/node-badge/frag.glsl.js +0 -8
- package/dist/cjs/programs/node-badge/index.js +0 -33
- package/dist/cjs/programs/node-badge/texture.js +0 -455
- package/dist/cjs/programs/node-badge/vert.glsl.js +0 -19
- package/dist/cjs/programs/node-circle/base/drawHover.js +0 -71
- package/dist/cjs/programs/node-circle/base/drawLabel.js +0 -113
- package/dist/cjs/programs/node-circle/base/frag.glsl.js +0 -8
- package/dist/cjs/programs/node-circle/base/index.js +0 -136
- package/dist/cjs/programs/node-circle/base/vert.glsl.js +0 -8
- package/dist/cjs/programs/node-circle/index.js +0 -15
- package/dist/cjs/programs/node-image/factory.js +0 -224
- package/dist/cjs/programs/node-image/frag.glsl.js +0 -8
- package/dist/cjs/programs/node-image/index.js +0 -14
- package/dist/cjs/programs/node-image/texture.js +0 -472
- package/dist/cjs/programs/node-image/vert.glsl.js +0 -8
- package/dist/cjs/programs/node-rect/base/drawHover.js +0 -68
- package/dist/cjs/programs/node-rect/base/drawLabel.js +0 -107
- package/dist/cjs/programs/node-rect/base/frag.glsl.js +0 -8
- package/dist/cjs/programs/node-rect/base/index.js +0 -135
- package/dist/cjs/programs/node-rect/base/vert.glsl.js +0 -8
- package/dist/cjs/programs/node-rect/index.js +0 -15
- package/dist/esm/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +0 -14
- package/dist/esm/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +0 -9
- package/dist/esm/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +0 -34
- package/dist/esm/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +0 -13
- package/dist/esm/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +0 -20
- package/dist/esm/_virtual/elk-worker.js +0 -8
- package/dist/esm/components/ContextMenu.js +0 -133
- package/dist/esm/components/Provider.js +0 -103
- package/dist/esm/components/Tools.js +0 -205
- package/dist/esm/components/Viewer.js +0 -59
- package/dist/esm/components/context.js +0 -33
- package/dist/esm/constants/index.js +0 -16
- package/dist/esm/hooks/sigmaDragSelect.js +0 -169
- package/dist/esm/hooks/sigmaHilighter.js +0 -83
- package/dist/esm/hooks/sigmaMouseActions.js +0 -145
- package/dist/esm/hooks/useGraphology.js +0 -41
- package/dist/esm/hooks/useSigma.js +0 -112
- package/dist/esm/programs/arrow-head/frag.glsl.js +0 -8
- package/dist/esm/programs/arrow-head/index.js +0 -141
- package/dist/esm/programs/arrow-head/vert.glsl.js +0 -8
- package/dist/esm/programs/edge-curve/drawLabel.js +0 -136
- package/dist/esm/programs/edge-curve/frag.glsl.js +0 -8
- package/dist/esm/programs/edge-curve/index.js +0 -156
- package/dist/esm/programs/edge-curve/vert.glsl.js +0 -8
- package/dist/esm/programs/edge-line/drawLabel.js +0 -70
- package/dist/esm/programs/edge-line/frag.glsl.js +0 -8
- package/dist/esm/programs/edge-line/index.js +0 -166
- package/dist/esm/programs/edge-line/vert.glsl.js +0 -8
- package/dist/esm/programs/node-badge/factory.js +0 -250
- package/dist/esm/programs/node-badge/frag.glsl.js +0 -8
- package/dist/esm/programs/node-badge/index.js +0 -32
- package/dist/esm/programs/node-badge/texture.js +0 -445
- package/dist/esm/programs/node-badge/vert.glsl.js +0 -19
- package/dist/esm/programs/node-circle/base/drawHover.js +0 -71
- package/dist/esm/programs/node-circle/base/drawLabel.js +0 -113
- package/dist/esm/programs/node-circle/base/frag.glsl.js +0 -8
- package/dist/esm/programs/node-circle/base/index.js +0 -136
- package/dist/esm/programs/node-circle/base/vert.glsl.js +0 -8
- package/dist/esm/programs/node-circle/index.js +0 -15
- package/dist/esm/programs/node-image/factory.js +0 -224
- package/dist/esm/programs/node-image/frag.glsl.js +0 -8
- package/dist/esm/programs/node-image/index.js +0 -13
- package/dist/esm/programs/node-image/texture.js +0 -462
- package/dist/esm/programs/node-image/vert.glsl.js +0 -8
- package/dist/esm/programs/node-rect/base/drawHover.js +0 -68
- package/dist/esm/programs/node-rect/base/drawLabel.js +0 -107
- package/dist/esm/programs/node-rect/base/frag.glsl.js +0 -8
- package/dist/esm/programs/node-rect/base/index.js +0 -135
- package/dist/esm/programs/node-rect/base/vert.glsl.js +0 -8
- package/dist/esm/programs/node-rect/index.js +0 -15
- package/dist/types/components/ContextMenu.d.ts +0 -1
- package/dist/types/components/Provider.d.ts +0 -3
- package/dist/types/components/Tools.d.ts +0 -1
- package/dist/types/components/Viewer.d.ts +0 -2
- package/dist/types/components/context.d.ts +0 -17
- package/dist/types/constants/index.d.ts +0 -12
- package/dist/types/graph/layout.worker.d.ts +0 -1
- package/dist/types/hooks/sigmaDragSelect.d.ts +0 -8
- package/dist/types/hooks/sigmaHilighter.d.ts +0 -3
- package/dist/types/hooks/sigmaMouseActions.d.ts +0 -3
- package/dist/types/hooks/useGraphology.d.ts +0 -6
- package/dist/types/hooks/useSigma.d.ts +0 -8
- package/dist/types/i18n/index.d.ts +0 -0
- package/dist/types/programs/arrow-head/frag.glsl.d.ts +0 -2
- package/dist/types/programs/arrow-head/index.d.ts +0 -9
- package/dist/types/programs/arrow-head/vert.glsl.d.ts +0 -2
- package/dist/types/programs/edge-curve/drawLabel.d.ts +0 -6
- package/dist/types/programs/edge-curve/frag.glsl.d.ts +0 -2
- package/dist/types/programs/edge-curve/index.d.ts +0 -43
- package/dist/types/programs/edge-curve/vert.glsl.d.ts +0 -2
- package/dist/types/programs/edge-line/drawLabel.d.ts +0 -5
- package/dist/types/programs/edge-line/frag.glsl.d.ts +0 -2
- package/dist/types/programs/edge-line/index.d.ts +0 -11
- package/dist/types/programs/edge-line/vert.glsl.d.ts +0 -2
- package/dist/types/programs/node-badge/factory.d.ts +0 -27
- package/dist/types/programs/node-badge/frag.glsl.d.ts +0 -2
- package/dist/types/programs/node-badge/index.d.ts +0 -5
- package/dist/types/programs/node-badge/texture.d.ts +0 -102
- package/dist/types/programs/node-badge/vert.glsl.d.ts +0 -2
- package/dist/types/programs/node-circle/base/drawHover.d.ts +0 -8
- package/dist/types/programs/node-circle/base/drawLabel.d.ts +0 -8
- package/dist/types/programs/node-circle/base/frag.glsl.d.ts +0 -2
- package/dist/types/programs/node-circle/base/index.d.ts +0 -37
- package/dist/types/programs/node-circle/base/vert.glsl.d.ts +0 -2
- package/dist/types/programs/node-circle/index.d.ts +0 -11
- package/dist/types/programs/node-image/factory.d.ts +0 -25
- package/dist/types/programs/node-image/frag.glsl.d.ts +0 -2
- package/dist/types/programs/node-image/index.d.ts +0 -5
- package/dist/types/programs/node-image/texture.d.ts +0 -102
- package/dist/types/programs/node-image/vert.glsl.d.ts +0 -2
- package/dist/types/programs/node-rect/base/drawHover.d.ts +0 -8
- package/dist/types/programs/node-rect/base/drawLabel.d.ts +0 -8
- package/dist/types/programs/node-rect/base/frag.glsl.d.ts +0 -2
- package/dist/types/programs/node-rect/base/index.d.ts +0 -34
- package/dist/types/programs/node-rect/base/vert.glsl.d.ts +0 -2
- package/dist/types/programs/node-rect/index.d.ts +0 -11
- package/src/components/ContextMenu.tsx +0 -138
- package/src/components/Provider.tsx +0 -116
- package/src/components/Tools.tsx +0 -68
- package/src/components/Viewer.tsx +0 -75
- package/src/components/context.ts +0 -43
- package/src/constants/index.ts +0 -22
- package/src/graph/layout.worker.ts +0 -42
- package/src/hooks/sigmaDragSelect.ts +0 -219
- package/src/hooks/sigmaHilighter.ts +0 -107
- package/src/hooks/sigmaMouseActions.ts +0 -153
- package/src/hooks/useGraphology.ts +0 -31
- package/src/hooks/useSigma.ts +0 -118
- package/src/i18n/index.ts +0 -0
- package/src/programs/arrow-head/frag.glsl.ts +0 -18
- package/src/programs/arrow-head/index.ts +0 -156
- package/src/programs/arrow-head/vert.glsl.ts +0 -75
- package/src/programs/edge-curve/drawLabel.ts +0 -166
- package/src/programs/edge-curve/frag.glsl.ts +0 -86
- package/src/programs/edge-curve/index.ts +0 -156
- package/src/programs/edge-curve/vert.glsl.ts +0 -110
- package/src/programs/edge-line/drawLabel.ts +0 -113
- package/src/programs/edge-line/frag.glsl.ts +0 -34
- package/src/programs/edge-line/index.ts +0 -163
- package/src/programs/edge-line/vert.glsl.ts +0 -104
- package/src/programs/node-badge/factory.ts +0 -325
- package/src/programs/node-badge/frag.glsl.ts +0 -79
- package/src/programs/node-badge/index.ts +0 -35
- package/src/programs/node-badge/texture.ts +0 -425
- package/src/programs/node-badge/vert.glsl.ts +0 -99
- package/src/programs/node-circle/base/drawHover.ts +0 -80
- package/src/programs/node-circle/base/drawLabel.ts +0 -145
- package/src/programs/node-circle/base/frag.glsl.ts +0 -72
- package/src/programs/node-circle/base/index.ts +0 -100
- package/src/programs/node-circle/base/vert.glsl.ts +0 -83
- package/src/programs/node-circle/index.ts +0 -19
- package/src/programs/node-image/factory.ts +0 -299
- package/src/programs/node-image/frag.glsl.ts +0 -97
- package/src/programs/node-image/index.ts +0 -7
- package/src/programs/node-image/texture.ts +0 -435
- package/src/programs/node-image/vert.glsl.ts +0 -60
- package/src/programs/node-rect/base/drawHover.ts +0 -77
- package/src/programs/node-rect/base/drawLabel.ts +0 -149
- package/src/programs/node-rect/base/frag.glsl.ts +0 -67
- package/src/programs/node-rect/base/index.ts +0 -107
- package/src/programs/node-rect/base/vert.glsl.ts +0 -87
- package/src/programs/node-rect/index.ts +0 -19
package/src/types/index.ts
CHANGED
|
@@ -1,210 +1,164 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
/**
|
|
2
|
+
* React Fabric
|
|
3
|
+
* @version 1.0.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2024 Adarsh Pastakia
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
export interface NodeAttributes<N extends KeyValue = KeyValue> {
|
|
27
|
+
data?: N;
|
|
28
|
+
|
|
29
|
+
id: string;
|
|
30
|
+
|
|
31
|
+
type?: string;
|
|
29
32
|
label?: string;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
type?: "circle" | "rect";
|
|
34
|
-
/**
|
|
35
|
-
* node size
|
|
36
|
-
*/
|
|
37
|
-
size?: number;
|
|
38
|
-
/**
|
|
39
|
-
* node weight to apply proportional size
|
|
40
|
-
*/
|
|
41
|
-
weight?: number;
|
|
42
|
-
/**
|
|
43
|
-
* label color
|
|
44
|
-
*/
|
|
45
|
-
labelColor?: string;
|
|
46
|
-
/**
|
|
47
|
-
* border color
|
|
48
|
-
*/
|
|
49
|
-
borderColor?: string;
|
|
50
|
-
/**
|
|
51
|
-
* icon color
|
|
52
|
-
*/
|
|
53
|
-
iconColor?: string;
|
|
54
|
-
/**
|
|
55
|
-
* fill color
|
|
56
|
-
*/
|
|
33
|
+
icon?: string;
|
|
34
|
+
image?: string;
|
|
35
|
+
|
|
57
36
|
color?: string;
|
|
58
|
-
/**
|
|
59
|
-
* border width
|
|
60
|
-
*/
|
|
61
37
|
border?: number;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
hoverColor?: string;
|
|
66
|
-
/**
|
|
67
|
-
* highlighted color
|
|
68
|
-
*/
|
|
69
|
-
highlightColor?: string;
|
|
70
|
-
/**
|
|
71
|
-
* define node type
|
|
72
|
-
*/
|
|
73
|
-
nodeType?: string;
|
|
74
|
-
/**
|
|
75
|
-
* pie colors
|
|
76
|
-
*/
|
|
77
|
-
pie?: string[];
|
|
78
|
-
/**
|
|
79
|
-
* svg path
|
|
80
|
-
*/
|
|
81
|
-
path?: string;
|
|
82
|
-
/**
|
|
83
|
-
* avatar/image url
|
|
84
|
-
*/
|
|
85
|
-
image?: string;
|
|
86
|
-
/**
|
|
87
|
-
* selected state
|
|
88
|
-
*/
|
|
89
|
-
selected?: boolean;
|
|
90
|
-
/**
|
|
91
|
-
* highlighted state
|
|
92
|
-
*/
|
|
93
|
-
highlight?: boolean;
|
|
38
|
+
borderColor?: string;
|
|
39
|
+
|
|
40
|
+
segments?: string[] | number[] | { [color: string]: number };
|
|
94
41
|
|
|
95
|
-
|
|
42
|
+
size?: number;
|
|
43
|
+
shape?: "square" | "circle" | "folder" | "diamond" | "triangle" | "folderOpen";
|
|
44
|
+
|
|
45
|
+
visible?: boolean;
|
|
96
46
|
|
|
97
47
|
x?: number;
|
|
98
48
|
y?: number;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
data?: N;
|
|
49
|
+
z?: number;
|
|
102
50
|
}
|
|
103
51
|
|
|
104
|
-
export interface EdgeAttributes<E = KeyValue> {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
52
|
+
export interface EdgeAttributes<E extends KeyValue = KeyValue> {
|
|
53
|
+
data?: E;
|
|
54
|
+
|
|
55
|
+
id: string;
|
|
56
|
+
source: string;
|
|
57
|
+
target: string;
|
|
58
|
+
|
|
59
|
+
type?: string;
|
|
112
60
|
label?: string;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
*/
|
|
61
|
+
count?: number;
|
|
62
|
+
|
|
116
63
|
size?: number;
|
|
117
|
-
/**
|
|
118
|
-
* edge weight to apply proportional size
|
|
119
|
-
*/
|
|
120
|
-
weight?: number;
|
|
121
|
-
/**
|
|
122
|
-
* edge color
|
|
123
|
-
*/
|
|
124
64
|
color?: string;
|
|
125
|
-
/**
|
|
126
|
-
* hover color
|
|
127
|
-
*/
|
|
128
|
-
hoverColor?: string;
|
|
129
|
-
/**
|
|
130
|
-
* highlighted color
|
|
131
|
-
*/
|
|
132
|
-
highlightColor?: string;
|
|
133
|
-
/**
|
|
134
|
-
* define edge type
|
|
135
|
-
*/
|
|
136
|
-
edgeType?: "curved" | "line";
|
|
137
|
-
/**
|
|
138
|
-
* edge arrow head
|
|
139
|
-
*/
|
|
140
|
-
arrow?: "source" | "target" | "both";
|
|
141
|
-
/**
|
|
142
|
-
* edge count
|
|
143
|
-
*/
|
|
144
|
-
count?: number;
|
|
145
65
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* highlighted state
|
|
152
|
-
*/
|
|
153
|
-
highlight?: boolean;
|
|
66
|
+
path?: "straight" | "curved" | "stepCurved" | "curvedS";
|
|
67
|
+
style?: "solid" | "dashed" | "dotted";
|
|
68
|
+
head?: "arrow";
|
|
69
|
+
tail?: "arrow";
|
|
154
70
|
|
|
155
|
-
|
|
71
|
+
visible?: boolean;
|
|
72
|
+
|
|
73
|
+
/** Marks a link that was created as a clone during `groupNodes`. Used by `ungroupNodes` to drop clones and revert the originals. */
|
|
74
|
+
groupEdge?: boolean;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface RawGraph<N extends KeyValue = KeyValue, E extends KeyValue = KeyValue> {
|
|
78
|
+
nodes: NodeAttributes<N>[];
|
|
79
|
+
edges: EdgeAttributes<E>[];
|
|
156
80
|
}
|
|
157
81
|
|
|
158
|
-
export interface
|
|
159
|
-
|
|
82
|
+
export interface InternalNode<N extends KeyValue = KeyValue> extends NodeAttributes<N> {
|
|
83
|
+
group?: boolean;
|
|
84
|
+
groupExpanded?: boolean;
|
|
85
|
+
groupNodes?: string[];
|
|
86
|
+
|
|
87
|
+
/** Back-reference to the group node that owns this (hidden) member. Empty for top-level nodes. */
|
|
160
88
|
groupId?: string;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
89
|
+
|
|
90
|
+
locked?: boolean;
|
|
91
|
+
|
|
92
|
+
/** Transient selection state, toggled by `selectNodes` / `unselectNodes`. */
|
|
93
|
+
selected?: boolean;
|
|
94
|
+
hilighted?: boolean;
|
|
95
|
+
|
|
96
|
+
x?: number;
|
|
97
|
+
y?: number;
|
|
98
|
+
z?: number;
|
|
99
|
+
|
|
100
|
+
fx?: number;
|
|
101
|
+
fy?: number;
|
|
102
|
+
fz?: number;
|
|
103
|
+
|
|
104
|
+
pieSize?: number;
|
|
105
|
+
slice_0?: number;
|
|
106
|
+
slice_1?: number;
|
|
107
|
+
slice_2?: number;
|
|
108
|
+
slice_3?: number;
|
|
109
|
+
slice_4?: number;
|
|
110
|
+
slice_5?: number;
|
|
111
|
+
slice_6?: number;
|
|
112
|
+
slice_7?: number;
|
|
113
|
+
slice_8?: number;
|
|
114
|
+
slice_9?: number;
|
|
115
|
+
slice_10?: number;
|
|
116
|
+
slice_11?: number;
|
|
117
|
+
color_0?: string;
|
|
118
|
+
color_1?: string;
|
|
119
|
+
color_2?: string;
|
|
120
|
+
color_3?: string;
|
|
121
|
+
color_4?: string;
|
|
122
|
+
color_5?: string;
|
|
123
|
+
color_6?: string;
|
|
124
|
+
color_7?: string;
|
|
125
|
+
color_8?: string;
|
|
126
|
+
color_9?: string;
|
|
127
|
+
color_10?: string;
|
|
128
|
+
color_11?: string;
|
|
173
129
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
130
|
+
|
|
131
|
+
export interface InternalEdge<E extends KeyValue = KeyValue> extends EdgeAttributes<E> {
|
|
132
|
+
group?: boolean;
|
|
133
|
+
|
|
134
|
+
/** Curvature of a `path: "curved"` edge; 0 = straight. Assigned by `assignCurvature` for parallel edges. */
|
|
177
135
|
curvature?: number;
|
|
178
|
-
id?: string;
|
|
179
|
-
}
|
|
180
136
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
edges: Array<{
|
|
184
|
-
key: string;
|
|
185
|
-
source: string;
|
|
186
|
-
target: string;
|
|
187
|
-
attributes?: EdgeAttributes<E>;
|
|
188
|
-
}>;
|
|
189
|
-
attributes?: KeyValue;
|
|
190
|
-
options?: GraphOptions;
|
|
191
|
-
}
|
|
137
|
+
/** Dash length for `layerDashed`, in relative edge-length units. Assigned by `assignEdgeDash` from `shape`. */
|
|
138
|
+
dashSize?: number;
|
|
192
139
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
140
|
+
/** Dash gap length for `layerDashed`, in relative edge-length units. Assigned by `assignEdgeDash` from `shape`. */
|
|
141
|
+
gapSize?: number;
|
|
196
142
|
|
|
197
|
-
|
|
198
|
-
ref?: RefObject<GraphRef<N, E> | null>;
|
|
199
|
-
data: RawGraph<N, E> | Graph<N, E>;
|
|
200
|
-
nodeReducer?: (node: NodeAttributes<N>) => NodeAttributes<N>;
|
|
201
|
-
edgeReducer?: (edge: EdgeAttributes<E>) => EdgeAttributes<E>;
|
|
143
|
+
rotation?: number;
|
|
202
144
|
|
|
203
|
-
|
|
145
|
+
/** Transient selection state. */
|
|
146
|
+
selected?: boolean;
|
|
204
147
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
148
|
+
/**
|
|
149
|
+
* The endpoint before it was re-pointed onto a group / merge node. Captured by
|
|
150
|
+
* `hydrateEdge` when the link is added; read back by `ungroupNode`.
|
|
151
|
+
*/
|
|
152
|
+
originalSource?: string;
|
|
153
|
+
originalTarget?: string;
|
|
210
154
|
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Public, listener-facing node: the node `id` merged with its `data` bag. This is
|
|
158
|
+
* what every `nodes*` event emits — internal fields (positions, pins, group and
|
|
159
|
+
* selection state) never leak to listeners.
|
|
160
|
+
*/
|
|
161
|
+
export type PublicNode<N extends KeyValue = KeyValue> = { id: string } & N;
|
|
162
|
+
|
|
163
|
+
/** Public, listener-facing link: the link `id` merged with its `data` bag. Emitted by `edges*` events. */
|
|
164
|
+
export type PublicEdge<E extends KeyValue = KeyValue> = { id: string } & E;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Fabric
|
|
3
|
+
* @version 1.0.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2024 Adarsh Pastakia
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import type { DisplayData } from "sigma/types";
|
|
27
|
+
import { DEFAULT_STYLES } from "sigma/types";
|
|
28
|
+
import type { EdgeAttributes } from "../types";
|
|
29
|
+
|
|
30
|
+
export function edgeReducer(_: unknown, edge: DisplayData, attrs: EdgeAttributes) {
|
|
31
|
+
// @ts-expect-error ignore
|
|
32
|
+
if (attrs.path === "curved") edge.curvature = 0.3;
|
|
33
|
+
if (attrs.style === "dashed") {
|
|
34
|
+
// @ts-expect-error ignore
|
|
35
|
+
edge.dashSize = 4;
|
|
36
|
+
// @ts-expect-error ignore
|
|
37
|
+
edge.gapSize = 8;
|
|
38
|
+
}
|
|
39
|
+
// @ts-expect-error ignore
|
|
40
|
+
if (attrs.style === "dotted") edge.dashSize = edge.gapSize = edge.size ?? 2;
|
|
41
|
+
return edge;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function defaultEdgeStyles(isDark = false) {
|
|
45
|
+
return [
|
|
46
|
+
DEFAULT_STYLES.edges as never,
|
|
47
|
+
{
|
|
48
|
+
size: { attribute: "size", defaultValue: 1 },
|
|
49
|
+
path: { attribute: "path", defaultValue: "straight" },
|
|
50
|
+
color: { attribute: "color", defaultValue: isDark ? "#475569" : "#94a3b8" },
|
|
51
|
+
|
|
52
|
+
head: { attribute: "head" },
|
|
53
|
+
tail: { attribute: "tail" },
|
|
54
|
+
|
|
55
|
+
gapSize: 0,
|
|
56
|
+
dashSize: 0,
|
|
57
|
+
parallelPath: "curved",
|
|
58
|
+
dashColor: isDark ? "#181818" : "#fff",
|
|
59
|
+
|
|
60
|
+
labelColor: isDark ? "#dedede" : "#545454",
|
|
61
|
+
labelVisibility: "auto",
|
|
62
|
+
labelPosition: "auto",
|
|
63
|
+
} as never,
|
|
64
|
+
];
|
|
65
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Fabric
|
|
3
|
+
* @version 1.0.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2024 Adarsh Pastakia
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { isArray, isObject } from "@react-fabric/utilities";
|
|
27
|
+
import { DEFAULT_STYLES, type DisplayData } from "sigma/types";
|
|
28
|
+
import type { InternalNode } from "../types";
|
|
29
|
+
|
|
30
|
+
const PIE_PALETTE = ["#2ad4ac", "#ea5353", "#39a1e6", "#f8a850", "#B64E84", "#92c652", "#ac7dc4", "#2c91bd", "#f8d653", "#D16082", "#52c8d7", "#475065"];
|
|
31
|
+
|
|
32
|
+
export function nodeReducer(_: unknown, node: DisplayData, attrs: InternalNode) {
|
|
33
|
+
if (isArray(attrs.segments) && attrs.segments?.length) {
|
|
34
|
+
// @ts-expect-error ignore
|
|
35
|
+
node.pieSize = 0.25;
|
|
36
|
+
attrs.segments.forEach((seg, i) => {
|
|
37
|
+
if (typeof seg === "string") {
|
|
38
|
+
// @ts-expect-error ignore
|
|
39
|
+
node[`slice_${i}`] = 1 / attrs.segments.length;
|
|
40
|
+
// @ts-expect-error ignore
|
|
41
|
+
node[`color_${i}`] = seg;
|
|
42
|
+
}
|
|
43
|
+
if (typeof seg === "number") {
|
|
44
|
+
// @ts-expect-error ignore
|
|
45
|
+
node[`slice_${i}`] = seg;
|
|
46
|
+
// @ts-expect-error ignore
|
|
47
|
+
node[`color_${i}`] = PIE_PALETTE[i];
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (isObject(attrs.segments)) {
|
|
52
|
+
// @ts-expect-error ignore
|
|
53
|
+
node.pieSize = 0.25;
|
|
54
|
+
Object.entries(attrs.segments).forEach(([color, size], i) => {
|
|
55
|
+
// @ts-expect-error ignore
|
|
56
|
+
node[`slice_${i}`] = size as number;
|
|
57
|
+
// @ts-expect-error ignore
|
|
58
|
+
node[`color_${i}`] = color;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (attrs.group) {
|
|
63
|
+
// @ts-expect-error ignore
|
|
64
|
+
node.shape = "folder";
|
|
65
|
+
}
|
|
66
|
+
return node;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function defaultNodeStyles(isDark = false) {
|
|
70
|
+
return [
|
|
71
|
+
DEFAULT_STYLES.nodes,
|
|
72
|
+
{
|
|
73
|
+
size: { attribute: "size", defaultValue: 8 },
|
|
74
|
+
shape: { attribute: "shape", defaultValue: "circle" },
|
|
75
|
+
color: { attribute: "color", defaultValue: isDark ? "#1e293b" : "#e2e8f0" },
|
|
76
|
+
|
|
77
|
+
border: { attribute: "border", defaultValue: 0 },
|
|
78
|
+
borderColor: { attribute: "borderColor", defaultValue: "#64748b" },
|
|
79
|
+
|
|
80
|
+
image: {
|
|
81
|
+
attribute: "image",
|
|
82
|
+
defaultValue: "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
pieSize: 0,
|
|
86
|
+
...Object.assign(
|
|
87
|
+
{},
|
|
88
|
+
...Array.from({ length: 12 })
|
|
89
|
+
.fill(0)
|
|
90
|
+
.map((_, i) => ({
|
|
91
|
+
[`slice_${i}`]: i === 0 ? 1 : 0,
|
|
92
|
+
[`color_${i}`]: "#888",
|
|
93
|
+
})),
|
|
94
|
+
),
|
|
95
|
+
|
|
96
|
+
labelPosition: "below",
|
|
97
|
+
labelColor: isDark ? "#fff" : "#333",
|
|
98
|
+
|
|
99
|
+
fillColor: isDark ? "#111" : "#fff",
|
|
100
|
+
|
|
101
|
+
backdropColor: isDark ? "#333" : "#fff",
|
|
102
|
+
backdropShadowColor: isDark ? "rgba(0, 0, 0, 0.5)" : "rgba(0, 0, 0, 0.3)",
|
|
103
|
+
},
|
|
104
|
+
] as never;
|
|
105
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Fabric
|
|
3
|
+
* @version 1.0.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2024 Adarsh Pastakia
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { GLSL_ROTATE_2D, type SDFShape, type ValueSource } from "sigma/rendering";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Options for the {@link sdfFolder} shape.
|
|
30
|
+
*
|
|
31
|
+
* @property cornerRadius - Corner rounding as a fraction of the node size.
|
|
32
|
+
* `0` gives sharp corners; larger values round the body and the tab. May
|
|
33
|
+
* also be a per-node attribute via `{ attribute, default }`.
|
|
34
|
+
* @property rotation - Rotation of the folder, in radians, applied before the
|
|
35
|
+
* distance field is evaluated. May also be a per-node attribute via
|
|
36
|
+
* `{ attribute, default }`.
|
|
37
|
+
*/
|
|
38
|
+
export interface FolderOptions {
|
|
39
|
+
/**
|
|
40
|
+
* Corner rounding as a fraction of the node size. Defaults to `0` (sharp
|
|
41
|
+
* corners).
|
|
42
|
+
*/
|
|
43
|
+
cornerRadius?: ValueSource<number>;
|
|
44
|
+
/**
|
|
45
|
+
* Rotation of the folder, in radians, applied before the distance is
|
|
46
|
+
* computed. Defaults to `0`.
|
|
47
|
+
*/
|
|
48
|
+
rotation?: ValueSource<number>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Resolves a {@link ValueSource} to a plain number, falling back to
|
|
53
|
+
* `defaultValue` when the value is attribute-sourced or missing.
|
|
54
|
+
*/
|
|
55
|
+
function resolveNumber(value: ValueSource<number> | undefined, defaultValue: number): number {
|
|
56
|
+
return typeof value === "number" ? value : defaultValue;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Creates a folder SDF shape.
|
|
61
|
+
*
|
|
62
|
+
* The outline is the union of two rounded rectangles: a wide **body** and a
|
|
63
|
+
* smaller **tab** flap that rises above the body's top-left corner — the shape
|
|
64
|
+
* of a classic manila folder. Each panel is an Inigo Quilez rounded-box
|
|
65
|
+
* distance field (https://iquilezles.org/articles/distfunctions2d/) and the
|
|
66
|
+
* union is the closer of the two distances.
|
|
67
|
+
*
|
|
68
|
+
* @param options - Configuration for the folder
|
|
69
|
+
* @returns Folder SDF shape definition
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* // Sharp folder with a top-left tab
|
|
74
|
+
* const folder = sdfFolder();
|
|
75
|
+
*
|
|
76
|
+
* // Rounded folder
|
|
77
|
+
* const rounded = sdfFolder({ cornerRadius: 0.12 });
|
|
78
|
+
*
|
|
79
|
+
* // Per-node folder, driven by attributes
|
|
80
|
+
* const perNode = sdfFolder({
|
|
81
|
+
* cornerRadius: { attribute: "folderCorner" },
|
|
82
|
+
* rotation: { attribute: "folderRotation" },
|
|
83
|
+
* });
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export function sdfFolder(options?: FolderOptions): SDFShape {
|
|
87
|
+
const { cornerRadius, rotation } = options ?? {};
|
|
88
|
+
const cornerRadiusValue = resolveNumber(cornerRadius, 0);
|
|
89
|
+
const rotationValue = resolveNumber(rotation, 0);
|
|
90
|
+
|
|
91
|
+
// SDF for a folder: the union of a wide body panel and a top-left tab flap,
|
|
92
|
+
// each an Inigo Quilez rounded box. The GLSL_ROTATE_2D helper is prepended so
|
|
93
|
+
// `rotation` can be applied; the framework deduplicates it across shapes.
|
|
94
|
+
const glsl = `${GLSL_ROTATE_2D}
|
|
95
|
+
float sdf_folder(vec2 uv, float size, float cornerRadius, float rotation) {
|
|
96
|
+
// Apply rotation if needed
|
|
97
|
+
vec2 p = uv;
|
|
98
|
+
if (rotation != 0.0) {
|
|
99
|
+
p = rotate2D(rotation) * p;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// A folder is the union of a wide body panel and a smaller tab flap that
|
|
103
|
+
// rises above the body's top-left. Each panel is a rounded box; the union is
|
|
104
|
+
// the closer of the two distances.
|
|
105
|
+
float s = size;
|
|
106
|
+
float cr = cornerRadius * s;
|
|
107
|
+
|
|
108
|
+
// Body: the main panel, wide and sitting just below the origin.
|
|
109
|
+
vec2 bodyD = abs(p - vec2(0.0, -0.05 * s)) - vec2(0.72 * s, 0.50 * s) + cr;
|
|
110
|
+
float body = length(max(bodyD, 0.0)) + min(max(bodyD.x, bodyD.y), 0.0) - cr;
|
|
111
|
+
|
|
112
|
+
// Tab: the top-left flap, its top edge poking above the body.
|
|
113
|
+
vec2 tabD = abs(p - vec2(-0.43 * s, 0.44 * s)) - vec2(0.29 * s, 0.20 * s) + cr;
|
|
114
|
+
float tab = length(max(tabD, 0.0)) + min(max(tabD.x, tabD.y), 0.0) - cr;
|
|
115
|
+
|
|
116
|
+
// Union of the two panels.
|
|
117
|
+
return min(body, tab);
|
|
118
|
+
}
|
|
119
|
+
`;
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
name: "folder",
|
|
123
|
+
glsl,
|
|
124
|
+
uniforms: [
|
|
125
|
+
{
|
|
126
|
+
name: "u_cornerRadius",
|
|
127
|
+
type: "float",
|
|
128
|
+
value: cornerRadiusValue,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "u_rotation",
|
|
132
|
+
type: "float",
|
|
133
|
+
value: rotationValue,
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
// The outline reaches out to the tab's top-left corner (circumradius
|
|
137
|
+
// ~0.96 of the node size); SQRT1_2 keeps the bounding quad comfortably
|
|
138
|
+
// larger, matching the square and diamond shapes.
|
|
139
|
+
inradiusFactor: Math.SQRT1_2,
|
|
140
|
+
};
|
|
141
|
+
}
|