Skip to content

Commit d1bff78

Browse files
authored
chore: correct layout comments and file name (#228)
* docs: fix typo * chore: update comments of layout * chore: update dict * chore: format filename
1 parent 46a2fe2 commit d1bff78

File tree

26 files changed

+151
-300
lines changed

26 files changed

+151
-300
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.DS_Store
2-
.vscode
32
.idea
43
npm-debug.log
54
yarn-error.log

.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"cSpell.words": [
3+
"acyclicer",
4+
"edgesep",
5+
"Fruchterman",
6+
"graphlib",
7+
"nodesep",
8+
"rankdir",
9+
"ranksep"
10+
]
11+
}

packages/layout-gpu/src/fruchterman.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,9 @@ interface FormattedOptions extends FruchtermanLayoutOptions {
3535
}
3636

3737
/**
38-
* Layout with fructherman force model
38+
* <zh/> Fruchterman 力导向布局(GPU 版)
3939
*
40-
* @example
41-
* // Assign layout options when initialization.
42-
* const layout = new FruchtermanLayout({ center: [100, 100] });
43-
* const positions = await layout.execute(graph); // { nodes: [], edges: [] }
44-
*
45-
* // Or use different options later.
46-
* const layout = new FruchtermanLayout({ center: [100, 100] });
47-
* const positions = await layout.execute(graph, { center: [100, 100] }); // { nodes: [], edges: [] }
48-
*
49-
* // If you want to assign the positions directly to the nodes, use assign method.
50-
* await layout.assign(graph, { center: [100, 100] });
40+
* <en/> Fruchterman force-directed layout(GPU)
5141
*/
5242
export class FruchtermanLayout implements Layout<FruchtermanLayoutOptions> {
5343
id = 'fruchtermanGPU';
@@ -71,7 +61,7 @@ export class FruchtermanLayout implements Layout<FruchtermanLayoutOptions> {
7161
* To directly assign the positions to the nodes.
7262
*/
7363
async assign(graph: Graph, options?: FruchtermanLayoutOptions) {
74-
await this.genericFruchtermanLayout(true, graph, options);
64+
await this.genericFruchtermanLayout(true, graph, options);
7565
}
7666

7767
private async genericFruchtermanLayout(

packages/layout-gpu/src/gforce.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,9 @@ interface FormattedOptions extends ForceLayoutOptions {
4949
}
5050

5151
/**
52-
* Layout with faster force
53-
*
54-
* @example
55-
* // Assign layout options when initialization.
56-
* const layout = new GForceLayout({ center: [100, 100] });
57-
* const positions = await layout.execute(graph); // { nodes: [], edges: [] }
58-
*
59-
* // Or use different options later.
60-
* const layout = new GForceLayout({ center: [100, 100] });
61-
* const positions = await layout.execute(graph, { center: [100, 100] }); // { nodes: [], edges: [] }
62-
*
63-
* // If you want to assign the positions directly to the nodes, use assign method.
64-
* await layout.assign(graph, { center: [100, 100] });
52+
* <zh/> 快速力导向布局
53+
*
54+
* <en/> Fast force-directed layout
6555
*/
6656
export class GForceLayout implements Layout<ForceLayoutOptions> {
6757
id = 'gforce';

packages/layout-wasm/src/force.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,9 @@ interface WASMForceLayoutOptions
3434
WASMLayoutOptions {}
3535

3636
/**
37-
* Layout nodes with force model
38-
*
39-
* @example
40-
* // Assign layout options when initialization.
41-
* const layout = new ForceLayout({ center: [100, 100] });
42-
* const positions = await layout.execute(graph); // { nodes: [], edges: [] }
43-
*
44-
* // Or use different options later.
45-
* const layout = new ForceLayout({ center: [100, 100] });
46-
* const positions = await layout.execute(graph, { center: [100, 100] }); // { nodes: [], edges: [] }
47-
*
48-
* // If you want to assign the positions directly to the nodes, use assign method.
49-
* await layout.assign(graph, { center: [100, 100] });
37+
* <zh/> 力导向布局(WASM 版)
38+
*
39+
* <en/> Force-directed layout(WASM)
5040
*/
5141
export class ForceLayout implements Layout<WASMForceLayoutOptions> {
5242
id = 'forceWASM';

packages/layout-wasm/src/forceatlas2.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,9 @@ interface FormattedOptions extends WASMForceAtlas2LayoutOptions {
5454
speed: number;
5555
}
5656
/**
57-
* Layout nodes with force atlas 2 model
57+
* <zh/> Atlas2 力导向布局(WASM 版)
5858
*
59-
* @example
60-
* // Assign layout options when initialization.
61-
* const layout = new ForceAtlas2Layout({ center: [100, 100] });
62-
* const positions = await layout.execute(graph); // { nodes: [], edges: [] }
63-
*
64-
* // Or use different options later.
65-
* const layout = new ForceAtlas2Layout({ center: [100, 100] });
66-
* const positions = await layout.execute(graph, { center: [100, 100] }); // { nodes: [], edges: [] }
67-
*
68-
* // If you want to assign the positions directly to the nodes, use assign method.
69-
* await layout.assign(graph, { center: [100, 100] });
59+
* <en/> Force Atlas 2 layout(WASM)
7060
*/
7161
export class ForceAtlas2Layout implements Layout<WASMForceAtlas2LayoutOptions> {
7262
id = 'forceAtlas2WASM';
@@ -90,7 +80,7 @@ export class ForceAtlas2Layout implements Layout<WASMForceAtlas2LayoutOptions> {
9080
* To directly assign the positions to the nodes.
9181
*/
9282
async assign(graph: Graph, options?: ForceAtlas2LayoutOptions) {
93-
await this.genericForceAtlas2Layout(true, graph, options);
83+
await this.genericForceAtlas2Layout(true, graph, options);
9484
}
9585

9686
private async genericForceAtlas2Layout(

packages/layout-wasm/src/fruchterman.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,9 @@ interface FormattedOptions extends WASMFruchtermanLayoutOptions {
3939
}
4040

4141
/**
42-
* Layout with fructherman force model
43-
*
44-
* @example
45-
* // Assign layout options when initialization.
46-
* const layout = new FruchtermanLayout({ threads, center: [100, 100] });
47-
* const positions = await layout.execute(graph); // { nodes: [], edges: [] }
48-
*
49-
* // Or use different options later.
50-
* const layout = new FruchtermanLayout({ center: [100, 100] });
51-
* const positions = await layout.execute(graph, { center: [100, 100] }); // { nodes: [], edges: [] }
52-
*
53-
* // If you want to assign the positions directly to the nodes, use assign method.
54-
* await layout.assign(graph, { center: [100, 100] });
42+
* <zh/> Fruchterman 力导向布局(WASM 版)
43+
*
44+
* <en/> Fruchterman force-directed layout(WASM)
5545
*/
5646
export class FruchtermanLayout implements Layout<WASMFruchtermanLayoutOptions> {
5747
id = 'fruchtermanWASM';

packages/layout/src/antv-dagre.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,9 @@ const DEFAULTS_LAYOUT_OPTIONS: Partial<AntVDagreLayoutOptions> = {
211211
};
212212

213213
/**
214-
* Layout arranging the nodes in a circle.
214+
* <zh/> AntV 实现的 Dagre 布局
215215
*
216-
* @example
217-
* // Assign layout options when initialization.
218-
* const layout = new CircularLayout({ radius: 10 });
219-
* const positions = await layout.execute(graph); // { nodes: [], edges: [] }
220-
*
221-
* // Or use different options later.
222-
* const layout = new CircularLayout({ radius: 10 });
223-
* const positions = await layout.execute(graph, { radius: 20 }); // { nodes: [], edges: [] }
224-
*
225-
* // If you want to assign the positions directly to the nodes, use assign method.
226-
* await layout.assign(graph, { radius: 20 });
216+
* <en/> AntV implementation of Dagre layout
227217
*/
228218
export class AntVDagreLayout implements Layout<AntVDagreLayoutOptions> {
229219
id = 'antv-dagre';

packages/layout/src/circular.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,9 @@ const DEFAULTS_LAYOUT_OPTIONS: Partial<CircularLayoutOptions> = {
2424
};
2525

2626
/**
27-
* Layout arranging the nodes in a circle.
27+
* <zh/> 环形布局
2828
*
29-
* @example
30-
* // Assign layout options when initialization.
31-
* const layout = new CircularLayout({ radius: 10 });
32-
* const positions = await layout.execute(graph); // { nodes: [], edges: [] }
33-
*
34-
* // Or use different options later.
35-
* const layout = new CircularLayout({ radius: 10 });
36-
* const positions = await layout.execute(graph, { radius: 20 }); // { nodes: [], edges: [] }
37-
*
38-
* // If you want to assign the positions directly to the nodes, use assign method.
39-
* await layout.assign(graph, { radius: 20 });
29+
* <en/> Circular layout
4030
*/
4131
export class CircularLayout implements Layout<CircularLayoutOptions> {
4232
id = 'circular';

packages/layout/src/comboCombined.ts renamed to packages/layout/src/combo-combined.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,9 @@ const DEFAULTS_LAYOUT_OPTIONS: Partial<ComboCombinedLayoutOptions> = {
3333
};
3434

3535
/**
36-
* Layout arranging the nodes and combos with combination of inner and outer layouts.
36+
* <zh/> 组合布局
3737
*
38-
* @example
39-
* // Assign layout options when initialization.
40-
* const layout = new ComboCombinedLayout({});
41-
* const positions = await layout.execute(graph); // { nodes: [], edges: [] }
42-
*
43-
* // Or use different options later.
44-
* const layout = new ComboCombinedLayout({ radius: 10 });
45-
* const positions = await layout.execute(graph, { radius: 20 }); // { nodes: [], edges: [] }
46-
*
47-
* // If you want to assign the positions directly to the nodes, use assign method.
48-
* await layout.assign(graph, { radius: 20 });
38+
* <en/> Combo-Combined layout
4939
*/
5040
export class ComboCombinedLayout implements Layout<ComboCombinedLayoutOptions> {
5141
id = 'comboCombined';

0 commit comments

Comments
 (0)