@logicflow/core 2.2.0 → 2.2.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/docs/api/logicflow-constructor/index.en.md +106 -0
- package/dist/docs/api/logicflow-constructor/index.zh.md +106 -0
- package/dist/docs/api/logicflow-constructor/use.en.md +61 -0
- package/dist/docs/api/logicflow-constructor/use.zh.md +61 -0
- package/dist/docs/api/logicflow-instance/canvas.en.md +197 -0
- package/dist/docs/api/logicflow-instance/canvas.zh.md +199 -0
- package/dist/docs/api/logicflow-instance/edge.en.md +273 -0
- package/dist/docs/api/logicflow-instance/edge.zh.md +273 -0
- package/dist/docs/api/logicflow-instance/edit-config.en.md +59 -0
- package/dist/docs/api/logicflow-instance/edit-config.zh.md +59 -0
- package/dist/docs/api/logicflow-instance/element.en.md +375 -0
- package/dist/docs/api/logicflow-instance/element.zh.md +379 -0
- package/dist/docs/api/logicflow-instance/event.en.md +326 -0
- package/dist/docs/api/logicflow-instance/event.zh.md +406 -0
- package/dist/docs/api/logicflow-instance/history.en.md +38 -0
- package/dist/docs/api/logicflow-instance/history.zh.md +38 -0
- package/dist/docs/api/logicflow-instance/index.en.md +41 -0
- package/dist/docs/api/logicflow-instance/index.zh.md +41 -0
- package/dist/docs/api/logicflow-instance/node.en.md +308 -0
- package/dist/docs/api/logicflow-instance/node.zh.md +308 -0
- package/dist/docs/api/logicflow-instance/register.en.md +76 -0
- package/dist/docs/api/logicflow-instance/register.zh.md +76 -0
- package/dist/docs/api/logicflow-instance/render-and-data.en.md +179 -0
- package/dist/docs/api/logicflow-instance/render-and-data.zh.md +181 -0
- package/dist/docs/api/logicflow-instance/text.en.md +60 -0
- package/dist/docs/api/logicflow-instance/text.zh.md +60 -0
- package/dist/docs/api/logicflow-instance/theme.en.md +179 -0
- package/dist/docs/api/logicflow-instance/theme.zh.md +179 -0
- package/dist/docs/api/runtime-model/edgeModel.en.md +29 -0
- package/dist/docs/api/runtime-model/edgeModel.zh.md +325 -0
- package/dist/docs/api/runtime-model/graphModel.en.md +275 -0
- package/dist/docs/api/runtime-model/graphModel.zh.md +1153 -0
- package/dist/docs/api/runtime-model/nodeModel.en.md +37 -0
- package/dist/docs/api/runtime-model/nodeModel.zh.md +644 -0
- package/dist/docs/api/type/MainTypes.en.md +598 -0
- package/dist/docs/api/type/MainTypes.zh.md +867 -0
- package/dist/docs/api/type/Theme.en.md +187 -0
- package/dist/docs/api/type/Theme.zh.md +187 -0
- package/dist/docs/api/type/canvas-types.en.md +25 -0
- package/dist/docs/api/type/canvas-types.zh.md +25 -0
- package/dist/docs/api/type/index.en.md +96 -0
- package/dist/docs/api/type/index.zh.md +99 -0
- package/dist/docs/api/type/node-types.en.md +21 -0
- package/dist/docs/api/type/node-types.zh.md +21 -0
- package/dist/docs/api/type/plugin-types.en.md +24 -0
- package/dist/docs/api/type/plugin-types.zh.md +24 -0
- package/dist/docs/index.md +11 -0
- package/dist/docs/tutorial/about.en.md +38 -0
- package/dist/docs/tutorial/about.zh.md +65 -0
- package/dist/docs/tutorial/advanced/dnd.en.md +62 -0
- package/dist/docs/tutorial/advanced/dnd.zh.md +52 -0
- package/dist/docs/tutorial/advanced/edge.en.md +64 -0
- package/dist/docs/tutorial/advanced/edge.zh.md +66 -0
- package/dist/docs/tutorial/advanced/keyboard.en.md +70 -0
- package/dist/docs/tutorial/advanced/keyboard.zh.md +67 -0
- package/dist/docs/tutorial/advanced/node.en.md +338 -0
- package/dist/docs/tutorial/advanced/node.zh.md +338 -0
- package/dist/docs/tutorial/advanced/react.en.md +106 -0
- package/dist/docs/tutorial/advanced/react.zh.md +114 -0
- package/dist/docs/tutorial/advanced/silent-mode.en.md +75 -0
- package/dist/docs/tutorial/advanced/silent-mode.zh.md +71 -0
- package/dist/docs/tutorial/advanced/snapline.en.md +54 -0
- package/dist/docs/tutorial/advanced/vue.en.md +249 -0
- package/dist/docs/tutorial/advanced/vue.zh.md +248 -0
- package/dist/docs/tutorial/ai.en.md +64 -0
- package/dist/docs/tutorial/ai.zh.md +64 -0
- package/dist/docs/tutorial/basic/background.en.md +50 -0
- package/dist/docs/tutorial/basic/canvas.en.md +164 -0
- package/dist/docs/tutorial/basic/canvas.zh.md +183 -0
- package/dist/docs/tutorial/basic/class.en.md +106 -0
- package/dist/docs/tutorial/basic/class.zh.md +103 -0
- package/dist/docs/tutorial/basic/edge.en.md +151 -0
- package/dist/docs/tutorial/basic/edge.zh.md +152 -0
- package/dist/docs/tutorial/basic/event.en.md +70 -0
- package/dist/docs/tutorial/basic/event.zh.md +66 -0
- package/dist/docs/tutorial/basic/grid.en.md +77 -0
- package/dist/docs/tutorial/basic/node.en.md +358 -0
- package/dist/docs/tutorial/basic/node.zh.md +318 -0
- package/dist/docs/tutorial/basic/theme.en.md +154 -0
- package/dist/docs/tutorial/basic/theme.zh.md +157 -0
- package/dist/docs/tutorial/extension/adapter.en.md +446 -0
- package/dist/docs/tutorial/extension/adapter.zh.md +429 -0
- package/dist/docs/tutorial/extension/bpmn-element.en.md +1427 -0
- package/dist/docs/tutorial/extension/bpmn-element.zh.md +1472 -0
- package/dist/docs/tutorial/extension/control.en.md +117 -0
- package/dist/docs/tutorial/extension/control.zh.md +118 -0
- package/dist/docs/tutorial/extension/curved-edge.en.md +46 -0
- package/dist/docs/tutorial/extension/curved-edge.zh.md +46 -0
- package/dist/docs/tutorial/extension/custom.en.md +142 -0
- package/dist/docs/tutorial/extension/custom.zh.md +138 -0
- package/dist/docs/tutorial/extension/dnd-panel.en.md +109 -0
- package/dist/docs/tutorial/extension/dnd-panel.zh.md +109 -0
- package/dist/docs/tutorial/extension/dynamic-group.en.md +606 -0
- package/dist/docs/tutorial/extension/dynamic-group.zh.md +606 -0
- package/dist/docs/tutorial/extension/group.en.md +217 -0
- package/dist/docs/tutorial/extension/group.zh.md +209 -0
- package/dist/docs/tutorial/extension/highlight.en.md +50 -0
- package/dist/docs/tutorial/extension/highlight.zh.md +50 -0
- package/dist/docs/tutorial/extension/insert-node-in-polyline.en.md +52 -0
- package/dist/docs/tutorial/extension/insert-node-in-polyline.zh.md +47 -0
- package/dist/docs/tutorial/extension/intro.en.md +72 -0
- package/dist/docs/tutorial/extension/intro.zh.md +95 -0
- package/dist/docs/tutorial/extension/label.en.md +136 -0
- package/dist/docs/tutorial/extension/label.zh.md +135 -0
- package/dist/docs/tutorial/extension/layout.en.md +156 -0
- package/dist/docs/tutorial/extension/layout.zh.md +156 -0
- package/dist/docs/tutorial/extension/menu.en.md +319 -0
- package/dist/docs/tutorial/extension/menu.zh.md +377 -0
- package/dist/docs/tutorial/extension/minimap.en.md +164 -0
- package/dist/docs/tutorial/extension/minimap.zh.md +180 -0
- package/dist/docs/tutorial/extension/node-resize.en.md +199 -0
- package/dist/docs/tutorial/extension/node-resize.zh.md +221 -0
- package/dist/docs/tutorial/extension/pool.en.md +227 -0
- package/dist/docs/tutorial/extension/pool.zh.md +227 -0
- package/dist/docs/tutorial/extension/proximity-connect.en.md +104 -0
- package/dist/docs/tutorial/extension/proximity-connect.zh.md +107 -0
- package/dist/docs/tutorial/extension/selection.en.md +166 -0
- package/dist/docs/tutorial/extension/selection.zh.md +150 -0
- package/dist/docs/tutorial/extension/snapshot.en.md +276 -0
- package/dist/docs/tutorial/extension/snapshot.zh.md +276 -0
- package/dist/docs/tutorial/get-started.en.md +501 -0
- package/dist/docs/tutorial/get-started.zh.md +139 -0
- package/dist/docs/tutorial/update.en.md +213 -0
- package/dist/docs/tutorial/update.zh.md +212 -0
- package/dist/index.css +3 -2
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/LogicFlow.d.ts +9 -0
- package/es/LogicFlow.js +0 -1
- package/es/constant/index.d.ts +1 -1
- package/es/constant/index.js +1 -1
- package/es/constant/theme.d.ts +136 -0
- package/es/constant/theme.js +680 -0
- package/es/index.css +3 -2
- package/es/model/GraphModel.d.ts +10 -2
- package/es/model/GraphModel.js +48 -14
- package/es/model/TransformModel.js +9 -9
- package/es/model/edge/BaseEdgeModel.js +7 -2
- package/es/model/edge/PolylineEdgeModel.d.ts +7 -0
- package/es/model/edge/PolylineEdgeModel.js +136 -7
- package/es/model/node/BaseNodeModel.d.ts +12 -1
- package/es/model/node/BaseNodeModel.js +9 -2
- package/es/model/node/HtmlNodeModel.d.ts +12 -0
- package/es/model/node/HtmlNodeModel.js +19 -0
- package/es/model/node/PolygonNodeModel.js +3 -3
- package/es/options.d.ts +4 -2
- package/es/style/index.css +3 -2
- package/es/style/index.less +3 -2
- package/es/style/raw.d.ts +1 -1
- package/es/style/raw.js +1 -1
- package/es/tool/MultipleSelectTool.js +10 -5
- package/es/util/drag.js +0 -1
- package/es/util/edge.d.ts +40 -1
- package/es/util/edge.js +43 -9
- package/es/util/geometry.d.ts +8 -0
- package/es/util/geometry.js +79 -0
- package/es/util/theme.d.ts +2 -65
- package/es/util/theme.js +4 -281
- package/es/view/Anchor.d.ts +1 -0
- package/es/view/Anchor.js +24 -21
- package/es/view/Control.d.ts +5 -0
- package/es/view/Control.js +44 -57
- package/es/view/edge/BaseEdge.js +9 -0
- package/es/view/edge/PolylineEdge.js +13 -2
- package/es/view/node/BaseNode.d.ts +1 -0
- package/es/view/node/BaseNode.js +23 -11
- package/es/view/node/HtmlNode.js +2 -4
- package/es/view/overlay/CanvasOverlay.js +5 -2
- package/es/view/overlay/Grid.d.ts +12 -1
- package/es/view/overlay/Grid.js +85 -23
- package/es/view/overlay/OutlineOverlay.d.ts +1 -0
- package/es/view/overlay/OutlineOverlay.js +18 -17
- package/es/view/overlay/gridConfig.d.ts +46 -0
- package/es/view/overlay/gridConfig.js +99 -0
- package/es/view/shape/Polygon.d.ts +0 -7
- package/es/view/shape/Polygon.js +12 -43
- package/lib/LogicFlow.d.ts +9 -0
- package/lib/LogicFlow.js +0 -1
- package/lib/constant/index.d.ts +1 -1
- package/lib/constant/index.js +16 -2
- package/lib/constant/theme.d.ts +136 -0
- package/lib/constant/theme.js +683 -0
- package/lib/index.css +3 -2
- package/lib/model/GraphModel.d.ts +10 -2
- package/lib/model/GraphModel.js +49 -15
- package/lib/model/TransformModel.js +9 -9
- package/lib/model/edge/BaseEdgeModel.js +7 -2
- package/lib/model/edge/PolylineEdgeModel.d.ts +7 -0
- package/lib/model/edge/PolylineEdgeModel.js +136 -7
- package/lib/model/node/BaseNodeModel.d.ts +12 -1
- package/lib/model/node/BaseNodeModel.js +9 -2
- package/lib/model/node/HtmlNodeModel.d.ts +12 -0
- package/lib/model/node/HtmlNodeModel.js +19 -0
- package/lib/model/node/PolygonNodeModel.js +3 -3
- package/lib/options.d.ts +4 -2
- package/lib/style/index.css +3 -2
- package/lib/style/index.less +3 -2
- package/lib/style/raw.d.ts +1 -1
- package/lib/style/raw.js +1 -1
- package/lib/tool/MultipleSelectTool.js +10 -5
- package/lib/util/drag.js +0 -1
- package/lib/util/edge.d.ts +40 -1
- package/lib/util/edge.js +43 -9
- package/lib/util/geometry.d.ts +8 -0
- package/lib/util/geometry.js +81 -1
- package/lib/util/theme.d.ts +2 -65
- package/lib/util/theme.js +15 -292
- package/lib/view/Anchor.d.ts +1 -0
- package/lib/view/Anchor.js +24 -21
- package/lib/view/Control.d.ts +5 -0
- package/lib/view/Control.js +44 -57
- package/lib/view/edge/BaseEdge.js +9 -0
- package/lib/view/edge/PolylineEdge.js +13 -2
- package/lib/view/node/BaseNode.d.ts +1 -0
- package/lib/view/node/BaseNode.js +22 -10
- package/lib/view/node/HtmlNode.js +1 -3
- package/lib/view/overlay/CanvasOverlay.js +5 -2
- package/lib/view/overlay/Grid.d.ts +12 -1
- package/lib/view/overlay/Grid.js +83 -21
- package/lib/view/overlay/OutlineOverlay.d.ts +1 -0
- package/lib/view/overlay/OutlineOverlay.js +18 -17
- package/lib/view/overlay/gridConfig.d.ts +46 -0
- package/lib/view/overlay/gridConfig.js +104 -0
- package/lib/view/shape/Polygon.d.ts +0 -7
- package/lib/view/shape/Polygon.js +13 -45
- package/package.json +9 -2
- package/scripts/postinstall-ai-prompt.js +67 -0
- package/.turbo/turbo-build$colon$dev.log +0 -10
- package/.turbo/turbo-build.log +0 -33
- package/CHANGELOG.md +0 -1849
- package/__tests__/algorithm/egde.test.ts +0 -131
- package/__tests__/algorithm/index.test.ts +0 -74
- package/__tests__/algorithm/outline.test.ts +0 -43
- package/__tests__/bugs/1545-spec.test.ts +0 -42
- package/__tests__/event/event.test.ts +0 -22
- package/__tests__/history/history.test.ts +0 -28
- package/__tests__/logicflow.test.ts +0 -575
- package/__tests__/model/graphmodel.test.ts +0 -87
- package/__tests__/util/compatible.test.ts +0 -48
- package/__tests__/util/edge.test.ts +0 -224
- package/__tests__/util/geometry.test.ts +0 -14
- package/__tests__/util/graph.test.ts +0 -16
- package/__tests__/util/matrix.test.ts +0 -41
- package/__tests__/util/node.test.ts +0 -68
- package/__tests__/util/sampling.test.ts +0 -12
- package/__tests__/util/vector.test.ts +0 -50
- package/__tests__/util/zIndex.test.ts +0 -10
- package/src/LogicFlow.tsx +0 -2008
- package/src/algorithm/edge.ts +0 -67
- package/src/algorithm/index.ts +0 -70
- package/src/algorithm/outline.ts +0 -77
- package/src/algorithm/rotate.ts +0 -55
- package/src/common/drag.ts +0 -219
- package/src/common/history.ts +0 -108
- package/src/common/index.ts +0 -6
- package/src/common/keyboard.ts +0 -108
- package/src/common/matrix.ts +0 -122
- package/src/common/vector.ts +0 -93
- package/src/constant/index.ts +0 -179
- package/src/event/event.md +0 -66
- package/src/event/eventArgs.ts +0 -643
- package/src/event/eventEmitter.ts +0 -156
- package/src/history/index.ts +0 -119
- package/src/index.less +0 -1
- package/src/index.ts +0 -26
- package/src/keyboard/index.ts +0 -112
- package/src/keyboard/shortcut.ts +0 -200
- package/src/model/BaseModel.ts +0 -250
- package/src/model/EditConfigModel.ts +0 -334
- package/src/model/GraphModel.ts +0 -1788
- package/src/model/NestedTransformModel.ts +0 -121
- package/src/model/SnaplineModel.ts +0 -256
- package/src/model/TransformModel.ts +0 -258
- package/src/model/edge/BaseEdgeModel.ts +0 -777
- package/src/model/edge/BezierEdgeModel.ts +0 -197
- package/src/model/edge/LineEdgeModel.ts +0 -36
- package/src/model/edge/PolylineEdgeModel.ts +0 -672
- package/src/model/edge/index.ts +0 -4
- package/src/model/index.ts +0 -9
- package/src/model/node/BaseNodeModel.ts +0 -949
- package/src/model/node/CircleNodeModel.ts +0 -91
- package/src/model/node/DiamondNodeModel.ts +0 -132
- package/src/model/node/EllipseNodeModel.ts +0 -98
- package/src/model/node/HtmlNodeModel.ts +0 -50
- package/src/model/node/PolygonNodeModel.ts +0 -150
- package/src/model/node/RectNodeModel.ts +0 -69
- package/src/model/node/TextNodeModel.ts +0 -54
- package/src/model/node/index.ts +0 -8
- package/src/options.ts +0 -145
- package/src/style/index.less +0 -261
- package/src/style/raw.ts +0 -220
- package/src/tool/MultipleSelectTool.tsx +0 -132
- package/src/tool/TextEditTool.tsx +0 -193
- package/src/tool/index.ts +0 -101
- package/src/typings.d.ts +0 -5
- package/src/util/animation.ts +0 -29
- package/src/util/browser.ts +0 -4
- package/src/util/compatible.ts +0 -15
- package/src/util/drag.ts +0 -220
- package/src/util/edge.ts +0 -1060
- package/src/util/geometry.ts +0 -55
- package/src/util/graph.ts +0 -46
- package/src/util/index.ts +0 -17
- package/src/util/matrix.ts +0 -129
- package/src/util/mobx.ts +0 -23
- package/src/util/node.ts +0 -543
- package/src/util/raf.ts +0 -28
- package/src/util/resize.ts +0 -606
- package/src/util/sampling.ts +0 -85
- package/src/util/theme.ts +0 -375
- package/src/util/uuid.ts +0 -26
- package/src/util/vector.ts +0 -93
- package/src/util/zIndex.ts +0 -6
- package/src/view/Anchor.tsx +0 -445
- package/src/view/Control.tsx +0 -512
- package/src/view/Graph.tsx +0 -141
- package/src/view/Rotate.tsx +0 -113
- package/src/view/behavior/dnd.ts +0 -162
- package/src/view/behavior/index.ts +0 -2
- package/src/view/behavior/snapline.ts +0 -16
- package/src/view/edge/AdjustPoint.tsx +0 -425
- package/src/view/edge/Arrow.tsx +0 -54
- package/src/view/edge/BaseEdge.tsx +0 -650
- package/src/view/edge/BezierEdge.tsx +0 -101
- package/src/view/edge/LineEdge.tsx +0 -81
- package/src/view/edge/PolylineEdge.tsx +0 -299
- package/src/view/edge/index.ts +0 -6
- package/src/view/index.ts +0 -8
- package/src/view/node/BaseNode.tsx +0 -571
- package/src/view/node/CircleNode.tsx +0 -21
- package/src/view/node/DiamondNode.tsx +0 -24
- package/src/view/node/EllipseNode.tsx +0 -22
- package/src/view/node/HtmlNode.tsx +0 -95
- package/src/view/node/PolygonNode.tsx +0 -28
- package/src/view/node/RectNode.tsx +0 -30
- package/src/view/node/TextNode.tsx +0 -39
- package/src/view/node/index.ts +0 -8
- package/src/view/overlay/BackgroundOverlay.tsx +0 -34
- package/src/view/overlay/BezierAdjustOverlay.tsx +0 -150
- package/src/view/overlay/CanvasOverlay.tsx +0 -288
- package/src/view/overlay/Grid.tsx +0 -162
- package/src/view/overlay/ModificationOverlay.tsx +0 -31
- package/src/view/overlay/OutlineOverlay.tsx +0 -170
- package/src/view/overlay/SnaplineOverlay.tsx +0 -44
- package/src/view/overlay/ToolOverlay.tsx +0 -65
- package/src/view/overlay/getTransformHoc.tsx +0 -50
- package/src/view/overlay/index.ts +0 -8
- package/src/view/shape/Circle.tsx +0 -41
- package/src/view/shape/Ellipse.tsx +0 -42
- package/src/view/shape/Line.tsx +0 -39
- package/src/view/shape/Path.tsx +0 -22
- package/src/view/shape/Polygon.tsx +0 -91
- package/src/view/shape/Polyline.tsx +0 -31
- package/src/view/shape/Rect.tsx +0 -44
- package/src/view/shape/Text.tsx +0 -169
- package/src/view/shape/index.ts +0 -8
- package/src/view/text/BaseText.tsx +0 -134
- package/src/view/text/LineText.tsx +0 -168
- package/src/view/text/index.ts +0 -2
- package/stats.html +0 -4842
- package/tsconfig.json +0 -18
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: API
|
|
3
|
+
group:
|
|
4
|
+
title: LogicFlow
|
|
5
|
+
order: 1
|
|
6
|
+
title: Constructor
|
|
7
|
+
toc: content
|
|
8
|
+
order: 0
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Calling the constructor
|
|
12
|
+
|
|
13
|
+
```tsx | pure
|
|
14
|
+
import LogicFlow from '@logicflow/core'
|
|
15
|
+
|
|
16
|
+
const options: LogicFlow.Options = {
|
|
17
|
+
// ...
|
|
18
|
+
}
|
|
19
|
+
new LogicFlow(options)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Basic options
|
|
23
|
+
|
|
24
|
+
| Option | Type | Required | Default | Description |
|
|
25
|
+
| :--------- | :---------- | :------- | :------ | :---------- |
|
|
26
|
+
| container | `HTMLElement` | Yes | - | DOM container for the diagram. |
|
|
27
|
+
| width | number | No | - | Canvas width in `px`; defaults to container width. |
|
|
28
|
+
| height | number | No | - | Canvas height in `px`; defaults to container height. |
|
|
29
|
+
| autoExpand | boolean | No | false | Expand the canvas when nodes are dragged near the edge. |
|
|
30
|
+
|
|
31
|
+
## Canvas options
|
|
32
|
+
|
|
33
|
+
| Option | Type | Required | Default | Description |
|
|
34
|
+
| :--------------- | :--- | :------- | :------ | :---------- |
|
|
35
|
+
| background | false \| [`BackgroundConfig`](../type/MainTypes.en.md#backgroundconfig) | No | false | Background layer; `false` disables it. |
|
|
36
|
+
| grid | number / boolean / [`GridOptions`](../type/MainTypes.en.md#gridoptions) | No | false | Grid configuration. |
|
|
37
|
+
| snapGrid | boolean | No | false | Snap dragging to the grid. |
|
|
38
|
+
| partial | boolean | No | false | Enable partial rendering for large graphs. |
|
|
39
|
+
| animation | boolean \| `Partial<AnimationConfig>`([`AnimationConfig`](../type/MainTypes.en.md#animationconfig)) | No | - | Animation toggles and per-kind settings. |
|
|
40
|
+
| overlapMode | [`OverlapMode`](../type/MainTypes.en.md#common) | No | - | Z-ordering when elements overlap. |
|
|
41
|
+
| snapline | boolean | No | true | Show snaplines while dragging nodes. |
|
|
42
|
+
| stopScrollGraph | boolean | No | false | Disable wheel panning. |
|
|
43
|
+
| stopZoomGraph | boolean | No | false | Disable zoom. |
|
|
44
|
+
| stopMoveGraph | boolean \| 'vertical' \| 'horizontal' \| [number, number, number, number] | No | false | Constrain or disable canvas panning. |
|
|
45
|
+
|
|
46
|
+
## Edit control
|
|
47
|
+
|
|
48
|
+
| Option | Type | Required | Default | Description |
|
|
49
|
+
| :--------------------- | :--- | :------- | :------ | :---------- |
|
|
50
|
+
| isSilentMode | boolean | No | false | Read-only / presentation mode. |
|
|
51
|
+
| guards | [`GuardsConfig`](../type/MainTypes.en.md#guardsconfig) | No | - | Guard callbacks (`beforeClone`, `beforeDelete`, …). |
|
|
52
|
+
| disabledTools | `string[]` | No | - | Built-in tools to disable. |
|
|
53
|
+
| adjustEdge | boolean | No | true | Allow edge adjustment. |
|
|
54
|
+
| adjustEdgeStartAndEnd | boolean | No | false | Allow dragging edge endpoints. |
|
|
55
|
+
| adjustNodePosition | boolean | No | true | Allow moving nodes. |
|
|
56
|
+
| hideAnchors | boolean | No | false | Hide node anchors. |
|
|
57
|
+
| outline | boolean | No | false | Outer selection box for nodes. |
|
|
58
|
+
| hoverOutline | boolean | No | true | Outline on hover. |
|
|
59
|
+
| nodeSelectedOutline | boolean | No | true | Outline when a node is selected. |
|
|
60
|
+
| edgeSelectedOutline | boolean | No | true | Outline when an edge is selected. |
|
|
61
|
+
| nodeTextEdit | boolean | No | true | Allow editing node text. |
|
|
62
|
+
| edgeTextEdit | boolean | No | true | Allow editing edge text. |
|
|
63
|
+
| textEdit | boolean | No | true | Master text-edit switch. |
|
|
64
|
+
| nodeTextDraggable | boolean | No | false | Allow dragging node text. |
|
|
65
|
+
| edgeTextDraggable | boolean | No | false | Allow dragging edge text. |
|
|
66
|
+
| multipleSelectKey | string | No | - | Multi-select modifier (`meta` / `shift` / `alt`). |
|
|
67
|
+
| idGenerator | function | No | - | Custom id generator for new nodes/edges. |
|
|
68
|
+
| customTargetAnchor | [`customTargetAnchorType`](../type/MainTypes.en.md#customtargetanchortype) | No | - | Custom anchor picking when connecting. |
|
|
69
|
+
| edgeGenerator | [`EdgeGeneratorType`](../type/MainTypes.en.md#edgegeneratortype) | No | - | Rule for edge type when connecting. |
|
|
70
|
+
| customTrajectory | function | No | - | Custom anchor line rendering. |
|
|
71
|
+
|
|
72
|
+
## Keyboard
|
|
73
|
+
|
|
74
|
+
| Option | Type | Required | Default | Description |
|
|
75
|
+
| :------- | :--- | :------- | :------ | :---------- |
|
|
76
|
+
| keyboard | [`KeyboardDef`](../type/MainTypes.en.md#keyboarddef) | No | - | Keyboard shortcuts configuration. |
|
|
77
|
+
|
|
78
|
+
Built-in shortcuts (when `keyboard.enabled = true`):
|
|
79
|
+
|
|
80
|
+
- `cmd + c` / `ctrl + c`: copy
|
|
81
|
+
- `cmd + v` / `ctrl + v`: paste
|
|
82
|
+
- `cmd + z` / `ctrl + z`: undo
|
|
83
|
+
- `cmd + y` / `ctrl + y`: redo
|
|
84
|
+
- `backspace`: delete
|
|
85
|
+
|
|
86
|
+
## Theme
|
|
87
|
+
|
|
88
|
+
| Option | Type | Required | Default | Description |
|
|
89
|
+
| :-------- | :--- | :------- | :------ | :---------- |
|
|
90
|
+
| style | [`Theme`](../type/Theme.en.md#theme) | No | - | Visual theme for nodes, edges, text, anchors, etc. |
|
|
91
|
+
| themeMode | string | No | - | Built-in presets: `default`, `dark`, `colorful`, `radius`. |
|
|
92
|
+
| edgeType | [`EdgeType`](../type/MainTypes.en.md#edgetype) | No | `polyline` | Default edge type created from the UI. |
|
|
93
|
+
|
|
94
|
+
## Plugins
|
|
95
|
+
|
|
96
|
+
| Option | Type | Required | Default | Description |
|
|
97
|
+
| :-------------- | :--- | :------- | :------ | :---------- |
|
|
98
|
+
| disabledPlugins | `string[]` | No | - | Plugins not to load at init. |
|
|
99
|
+
| plugins | [`ExtensionConstructor`](../type/MainTypes.en.md#extensionconstructor)`[]` | No | - | Plugins for this instance; falls back to global list. |
|
|
100
|
+
| pluginsOptions | any | No | - | Options passed to plugins. |
|
|
101
|
+
|
|
102
|
+
## History
|
|
103
|
+
|
|
104
|
+
| Option | Type | Required | Default | Description |
|
|
105
|
+
| :------ | :--- | :------- | :------ | :---------- |
|
|
106
|
+
| history | boolean | No | true | Enable undo/redo stack. |
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: API
|
|
3
|
+
group:
|
|
4
|
+
title: LogicFlow
|
|
5
|
+
order: 1
|
|
6
|
+
title: 构造方法
|
|
7
|
+
toc: content
|
|
8
|
+
order: 0
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 构造方法调用
|
|
12
|
+
|
|
13
|
+
```tsx | pure
|
|
14
|
+
import LogicFlow from '@logicflow/core'
|
|
15
|
+
|
|
16
|
+
const options: LogicFlow.Options = {
|
|
17
|
+
// ...
|
|
18
|
+
}
|
|
19
|
+
new LogicFlow(options)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 基础配置
|
|
23
|
+
|
|
24
|
+
| 选项 | 类型 | 必选 | 默认值 | 描述 |
|
|
25
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
26
|
+
| container | `HTMLElement` | ✅ | - | 图的 DOM 容器。 |
|
|
27
|
+
| width | number | - | - | 指定画布宽度,单位为 `px`,默认使用容器宽度。 |
|
|
28
|
+
| height | number | - | - | 指定画布高度,单位为 `px`,默认使用容器高度。 |
|
|
29
|
+
| autoExpand | boolean | - | false | 节点拖动靠近画布边缘时是否自动扩充画布。 |
|
|
30
|
+
|
|
31
|
+
## 画布配置
|
|
32
|
+
|
|
33
|
+
| 选项 | 类型 | 必选 | 默认值 | 描述 |
|
|
34
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
35
|
+
| background | false \| [`BackgroundConfig`](../type/MainTypes.zh.md#backgroundconfig背景配置) | - | false | 画布背景,默认无背景,支持传入参数配置。 |
|
|
36
|
+
| grid | number / boolean / [`GridOptions`](../type/MainTypes.zh.md#gridoptions网格配置) | - | false | 网格配置,支持关闭、默认点状网格或自定义参数。 |
|
|
37
|
+
| snapGrid | boolean | - | false | 是否开启网格吸附。 |
|
|
38
|
+
| partial | boolean | - | false | 是否开启局部渲染功能。 |
|
|
39
|
+
| animation | boolean \| `Partial<AnimationConfig>`([`AnimationConfig`](../type/MainTypes.zh.md#animationconfig动画配置)) | - | - | 是否开启动画功能,可统一开关和单独配置。 |
|
|
40
|
+
| overlapMode | [`OverlapMode`](../type/MainTypes.zh.md#common实例基础配置项) | - | - | 元素重合堆叠模式。 |
|
|
41
|
+
| snapline | boolean | - | true | 是否启用节点辅助对齐线。 |
|
|
42
|
+
| stopScrollGraph | boolean | - | false | 禁止鼠标滚动移动画布。 |
|
|
43
|
+
| stopZoomGraph | boolean | - | false | 禁止缩放画布。 |
|
|
44
|
+
| stopMoveGraph | boolean \| 'vertical' \| 'horizontal' \| [number, number, number, number] | - | false | 禁止拖动画布。 |
|
|
45
|
+
|
|
46
|
+
## 编辑控制
|
|
47
|
+
|
|
48
|
+
| 选项 | 类型 | 必选 | 默认值 | 描述 |
|
|
49
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
50
|
+
| isSilentMode | boolean | - | false | 仅浏览不可编辑模式,默认不开启。 |
|
|
51
|
+
| guards | [`GuardsConfig`](../type/MainTypes.zh.md#guardsconfig守卫函数类型) | - | - | 守卫函数配置(`beforeClone`、`beforeDelete`)。 |
|
|
52
|
+
| disabledTools | `string[]` | - | - | 禁止启用的内置工具。 |
|
|
53
|
+
| adjustEdge | boolean | - | true | 允许调整边。 |
|
|
54
|
+
| adjustEdgeStartAndEnd | boolean | - | false | 是否允许拖动边端点调整连线。 |
|
|
55
|
+
| adjustNodePosition | boolean | - | true | 是否允许拖动节点。 |
|
|
56
|
+
| hideAnchors | boolean | - | false | 是否隐藏节点锚点。 |
|
|
57
|
+
| outline | boolean | - | false | 节点选择外侧选框是否展示。 |
|
|
58
|
+
| hoverOutline | boolean | - | true | 鼠标悬停时是否显示节点外框。 |
|
|
59
|
+
| nodeSelectedOutline | boolean | - | true | 节点选中时是否显示节点外框。 |
|
|
60
|
+
| edgeSelectedOutline | boolean | - | true | 边选中时是否显示边外框。 |
|
|
61
|
+
| nodeTextEdit | boolean | - | true | 允许节点文本编辑。 |
|
|
62
|
+
| edgeTextEdit | boolean | - | true | 允许边文本编辑。 |
|
|
63
|
+
| textEdit | boolean | - | true | 是否开启文本编辑。 |
|
|
64
|
+
| nodeTextDraggable | boolean | - | false | 允许节点文本拖拽。 |
|
|
65
|
+
| edgeTextDraggable | boolean | - | false | 允许边文本拖拽。 |
|
|
66
|
+
| multipleSelectKey | string | - | - | 多选按键(`meta` / `shift` / `alt`)。 |
|
|
67
|
+
| idGenerator | function | - | - | 自定义创建节点、连线时的 ID 生成规则。 |
|
|
68
|
+
| customTargetAnchor | [`customTargetAnchorType`](../type/MainTypes.zh.md#customtargetanchortype自定义锚点连接规则) | - | - | 自定义锚点连接规则。 |
|
|
69
|
+
| edgeGenerator | [`EdgeGeneratorType`](../type/MainTypes.zh.md#edgegeneratortype自定义边生成函数) | - | - | 连接节点及移动边时边的生成规则。 |
|
|
70
|
+
| customTrajectory | function | - | - | 自定义连线轨迹。 |
|
|
71
|
+
|
|
72
|
+
## 快捷键配置
|
|
73
|
+
|
|
74
|
+
| 选项 | 类型 | 必选 | 默认值 | 描述 |
|
|
75
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
76
|
+
| keyboard | [`KeyboardDef`](../type/MainTypes.zh.md#keyboarddef快捷键参数类型) | - | - | 自定义键盘相关配置。 |
|
|
77
|
+
|
|
78
|
+
内置快捷键(启用 `keyboard.enabled = true` 后可用):
|
|
79
|
+
|
|
80
|
+
- `cmd + c` / `ctrl + c`:复制
|
|
81
|
+
- `cmd + v` / `ctrl + v`:粘贴
|
|
82
|
+
- `cmd + z` / `ctrl + z`:撤销
|
|
83
|
+
- `cmd + y` / `ctrl + y`:重做
|
|
84
|
+
- `backspace`:删除
|
|
85
|
+
|
|
86
|
+
## 主题配置
|
|
87
|
+
|
|
88
|
+
| 选项 | 类型 | 必选 | 默认值 | 描述 |
|
|
89
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
90
|
+
| style | [`Theme`](../type/Theme.zh.md#theme主题配置) | - | - | 样式配置,用于定义节点、边、文本、锚点等视觉效果。 |
|
|
91
|
+
| themeMode | string | - | - | 主题类型,内置支持 `default` / `dark` / `colorful` / `radius`。 |
|
|
92
|
+
| edgeType | [`EdgeType`](../type/MainTypes.zh.md#edgetype边类型) | - | `polyline` | 在图上编辑创建边的默认类型。 |
|
|
93
|
+
|
|
94
|
+
## 插件控制
|
|
95
|
+
|
|
96
|
+
| 选项 | 类型 | 必选 | 默认值 | 描述 |
|
|
97
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
98
|
+
| disabledPlugins | `string[]` | - | - | 初始化时禁用加载的插件。 |
|
|
99
|
+
| plugins | [`ExtensionConstructor`](../type/MainTypes.zh.md#extensionconstructor插件构造函数)`[]` | - | - | 当前实例加载的插件,不传则采用全局插件。 |
|
|
100
|
+
| pluginsOptions | any | - | - | 插件初始化选项。 |
|
|
101
|
+
|
|
102
|
+
## 历史记录
|
|
103
|
+
|
|
104
|
+
| 选项 | 类型 | 必选 | 默认值 | 描述 |
|
|
105
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
106
|
+
| history | boolean | - | true | 是否开启历史记录功能。 |
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: API
|
|
3
|
+
group:
|
|
4
|
+
title: LogicFlow
|
|
5
|
+
order: 1
|
|
6
|
+
title: LogicFlow.use
|
|
7
|
+
toc: content
|
|
8
|
+
order: 1
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Register a plugin globally.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
LogicFlow.use(
|
|
15
|
+
extension: ExtensionConstructor | ExtensionDefinition,
|
|
16
|
+
props?: Record<string, unknown>,
|
|
17
|
+
): void
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Parameters:
|
|
21
|
+
|
|
22
|
+
| Name | Type | Required | Description |
|
|
23
|
+
| :--- | :--- | :--- | :--- |
|
|
24
|
+
| `extension` | [`ExtensionConstructor`](../type/MainTypes.en.md#extensionconstructor) \| [`ExtensionDefinition`](../type/MainTypes.en.md#extensiondefinition) | Yes | Plugin constructor or definition object. |
|
|
25
|
+
| `props` | `Record<string, unknown>` | No | Options passed to the plugin at registration time. |
|
|
26
|
+
|
|
27
|
+
Example:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import LogicFlow from '@logicflow/core'
|
|
31
|
+
|
|
32
|
+
class CustomPlugin {
|
|
33
|
+
static pluginName = 'CustomPlugin'
|
|
34
|
+
|
|
35
|
+
constructor({ lf, LogicFlow, props }) {
|
|
36
|
+
this.lf = lf
|
|
37
|
+
this.LogicFlow = LogicFlow
|
|
38
|
+
this.props = props
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
render(lf, container) {
|
|
42
|
+
const el = document.createElement('div')
|
|
43
|
+
el.textContent = 'Custom plugin'
|
|
44
|
+
container.appendChild(el)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
destroy() {
|
|
48
|
+
// Clean up listeners, timers, etc.
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
LogicFlow.use(CustomPlugin, {
|
|
53
|
+
featureFlag: true,
|
|
54
|
+
})
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Notes:
|
|
58
|
+
|
|
59
|
+
- `use` is static: call `LogicFlow.use(...)`.
|
|
60
|
+
- Plugins should expose a unique `pluginName` to avoid collisions.
|
|
61
|
+
- Whether a plugin runs for a given instance also depends on instance options (for example disabled lists).
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: API
|
|
3
|
+
group:
|
|
4
|
+
title: LogicFlow
|
|
5
|
+
order: 1
|
|
6
|
+
title: LogicFlow.use
|
|
7
|
+
toc: content
|
|
8
|
+
order: 1
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
全局注册插件。
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
LogicFlow.use(
|
|
15
|
+
extension: ExtensionConstructor | ExtensionDefinition,
|
|
16
|
+
props?: Record<string, unknown>,
|
|
17
|
+
): void
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
参数说明:
|
|
21
|
+
|
|
22
|
+
| 名称 | 类型 | 必传 | 描述 |
|
|
23
|
+
| :--- | :--- | :--- | :--- |
|
|
24
|
+
| `extension` | [`ExtensionConstructor`](../type/MainTypes.zh.md#extensionconstructor插件构造函数) \| [`ExtensionDefinition`](../type/MainTypes.zh.md#extensiondefinition插件定义) | 是 | 插件构造器或插件定义对象 |
|
|
25
|
+
| `props` | `Record<string, unknown>` | 否 | 注册时传入的插件配置 |
|
|
26
|
+
|
|
27
|
+
示例:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import LogicFlow from '@logicflow/core'
|
|
31
|
+
|
|
32
|
+
class CustomPlugin {
|
|
33
|
+
static pluginName = 'CustomPlugin'
|
|
34
|
+
|
|
35
|
+
constructor({ lf, LogicFlow, props }) {
|
|
36
|
+
this.lf = lf
|
|
37
|
+
this.LogicFlow = LogicFlow
|
|
38
|
+
this.props = props
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
render(lf, container) {
|
|
42
|
+
const el = document.createElement('div')
|
|
43
|
+
el.textContent = 'Custom plugin'
|
|
44
|
+
container.appendChild(el)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
destroy() {
|
|
48
|
+
// 清理监听、定时器等资源
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
LogicFlow.use(CustomPlugin, {
|
|
53
|
+
featureFlag: true,
|
|
54
|
+
})
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
说明:
|
|
58
|
+
|
|
59
|
+
- `use` 是静态方法,需通过 `LogicFlow.use(...)` 调用。
|
|
60
|
+
- 插件应提供唯一的 `pluginName`,避免同名冲突。
|
|
61
|
+
- 插件是否在某个实例内生效,还受实例配置(如禁用列表)影响。
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: API
|
|
3
|
+
group:
|
|
4
|
+
title: LogicFlow Instance
|
|
5
|
+
order: 2
|
|
6
|
+
title: Canvas
|
|
7
|
+
toc: content
|
|
8
|
+
order: 8
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
This page documents instance APIs for canvas size, viewport transforms, coordinate conversion, and edge animation.
|
|
12
|
+
|
|
13
|
+
### resize
|
|
14
|
+
|
|
15
|
+
Resize the canvas; when omitted, width and height are recomputed from the container.
|
|
16
|
+
|
|
17
|
+
**Signature**
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
resize(width?: number, height?: number): void
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Parameters**
|
|
24
|
+
|
|
25
|
+
| Name | Type | Required | Description |
|
|
26
|
+
| :--- | :--- | :--- | :--- |
|
|
27
|
+
| `width` | `number` | No | Target width. |
|
|
28
|
+
| `height` | `number` | No | Target height. |
|
|
29
|
+
|
|
30
|
+
### focusOn
|
|
31
|
+
|
|
32
|
+
Center the viewport on a node id or a canvas coordinate.
|
|
33
|
+
|
|
34
|
+
**Signature**
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
focusOn(focusOnArgs: { id?: string; coordinate?: { x: number; y: number } }): void
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Parameters**
|
|
41
|
+
|
|
42
|
+
| Name | Type | Required | Description |
|
|
43
|
+
| :--- | :--- | :--- | :--- |
|
|
44
|
+
| `focusOnArgs` | `object` | Yes | Provide either `id` or `coordinate`. |
|
|
45
|
+
|
|
46
|
+
### zoom
|
|
47
|
+
|
|
48
|
+
Zoom by step or explicit ratio, optionally around a point.
|
|
49
|
+
|
|
50
|
+
**Signature**
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
zoom(zoomSize?: boolean | number, point?: [number, number]): string
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Returns**
|
|
57
|
+
|
|
58
|
+
- `string`: current zoom as a percentage string.
|
|
59
|
+
|
|
60
|
+
### resetZoom
|
|
61
|
+
|
|
62
|
+
Reset zoom to `1`.
|
|
63
|
+
|
|
64
|
+
**Signature**
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
resetZoom(): void
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### setZoomMiniSize
|
|
71
|
+
|
|
72
|
+
Set the minimum allowed zoom factor.
|
|
73
|
+
|
|
74
|
+
**Signature**
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
setZoomMiniSize(size: number): void
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### setZoomMaxSize
|
|
81
|
+
|
|
82
|
+
Set the maximum allowed zoom factor.
|
|
83
|
+
|
|
84
|
+
**Signature**
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
setZoomMaxSize(size: number): void
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### getTransform
|
|
91
|
+
|
|
92
|
+
Read the current transform (scale and translation).
|
|
93
|
+
|
|
94
|
+
**Signature**
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
getTransform(): {
|
|
98
|
+
SCALE_X: number;
|
|
99
|
+
SCALE_Y: number;
|
|
100
|
+
TRANSLATE_X: number;
|
|
101
|
+
TRANSLATE_Y: number;
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### translate
|
|
106
|
+
|
|
107
|
+
Translate the canvas by a relative offset.
|
|
108
|
+
|
|
109
|
+
**Signature**
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
translate(x: number, y: number): void
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### resetTranslate
|
|
116
|
+
|
|
117
|
+
Reset translation to the initial state.
|
|
118
|
+
|
|
119
|
+
**Signature**
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
resetTranslate(): void
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### translateCenter
|
|
126
|
+
|
|
127
|
+
Center the graph content inside the viewport.
|
|
128
|
+
|
|
129
|
+
**Signature**
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
translateCenter(): void
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### fitView
|
|
136
|
+
|
|
137
|
+
Adjust zoom and translation so the graph fits the viewport.
|
|
138
|
+
|
|
139
|
+
**Signature**
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
fitView(verticalOffset?: number, horizontalOffset?: number): void
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### getPointByClient
|
|
146
|
+
|
|
147
|
+
Convert page coordinates to overlay positions (DOM and canvas layers).
|
|
148
|
+
|
|
149
|
+
**Signature**
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
getPointByClient(x: number, y: number): {
|
|
153
|
+
domOverlayPosition: { x: number; y: number };
|
|
154
|
+
canvasOverlayPosition: { x: number; y: number };
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### toFront
|
|
159
|
+
|
|
160
|
+
Raise the z-order of a node or edge.
|
|
161
|
+
|
|
162
|
+
**Signature**
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
toFront(id: string): void
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### openEdgeAnimation
|
|
169
|
+
|
|
170
|
+
Enable animation for an edge.
|
|
171
|
+
|
|
172
|
+
**Signature**
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
openEdgeAnimation(edgeId: string): void
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### closeEdgeAnimation
|
|
179
|
+
|
|
180
|
+
Disable animation for an edge.
|
|
181
|
+
|
|
182
|
+
**Signature**
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
closeEdgeAnimation(edgeId: string): void
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Common recipes
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
lf.resize();
|
|
192
|
+
lf.translateCenter();
|
|
193
|
+
lf.zoom(1.2);
|
|
194
|
+
|
|
195
|
+
const point = lf.getPointByClient(300, 200);
|
|
196
|
+
lf.focusOn({ coordinate: point.canvasOverlayPosition });
|
|
197
|
+
```
|