@kabel-project/kabel 1.0.7
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/(1.0.7)kabel.md +18 -0
- package/README.md +96 -0
- package/_READ_ME_MEDIA_/documentation/docs.md +293 -0
- package/_READ_ME_MEDIA_/workspace.png +0 -0
- package/comment-renderer/renderer.ts +228 -0
- package/controllers/base.ts +186 -0
- package/controllers/wasd.ts +132 -0
- package/docs/README.md +98 -0
- package/docs/_media/docs.md +289 -0
- package/docs/_media/index.html +168 -0
- package/docs/_media/workspace.png +0 -0
- package/docs/classes/CommentModel.md +271 -0
- package/docs/classes/CommentRenderer.md +457 -0
- package/docs/classes/ConnectableField.md +597 -0
- package/docs/classes/Connection.md +191 -0
- package/docs/classes/ContextMenuHTML.md +163 -0
- package/docs/classes/Coordinates.md +187 -0
- package/docs/classes/DropdownContainer.md +300 -0
- package/docs/classes/DummyField.md +393 -0
- package/docs/classes/Eventer.md +185 -0
- package/docs/classes/Field.md +461 -0
- package/docs/classes/InjectMsg.md +85 -0
- package/docs/classes/NodeSvg.md +1011 -0
- package/docs/classes/NumberField.md +559 -0
- package/docs/classes/OptConnectField.md +624 -0
- package/docs/classes/Renderer.md +1636 -0
- package/docs/classes/RendererConstants.md +343 -0
- package/docs/classes/Representer.md +95 -0
- package/docs/classes/RepresenterNode.md +175 -0
- package/docs/classes/TextField.md +559 -0
- package/docs/classes/Toolbox.md +172 -0
- package/docs/classes/WASDController.md +616 -0
- package/docs/classes/Widget.md +195 -0
- package/docs/classes/WorkspaceController.md +385 -0
- package/docs/classes/WorkspaceCoords.md +218 -0
- package/docs/classes/WorkspaceSvg.md +1380 -0
- package/docs/functions/clearMainWorkspace.md +20 -0
- package/docs/functions/getMainWorkspace.md +19 -0
- package/docs/functions/inject.md +35 -0
- package/docs/functions/setMainWorkspace.md +28 -0
- package/docs/globals.md +95 -0
- package/docs/interfaces/ColorStyle.md +43 -0
- package/docs/interfaces/ConnectorToFrom.md +57 -0
- package/docs/interfaces/DrawState.md +81 -0
- package/docs/interfaces/FieldConnectionData.md +25 -0
- package/docs/interfaces/FieldOptions.md +63 -0
- package/docs/interfaces/FieldRawBoxData.md +25 -0
- package/docs/interfaces/FieldVisualInfo.md +65 -0
- package/docs/interfaces/GridOptions.md +61 -0
- package/docs/interfaces/InjectOptions.md +133 -0
- package/docs/interfaces/InputFieldJson.md +50 -0
- package/docs/interfaces/KabelCommentRendering.md +31 -0
- package/docs/interfaces/KabelInterface.md +469 -0
- package/docs/interfaces/KabelNodeRendering.md +77 -0
- package/docs/interfaces/KabelUIX.md +105 -0
- package/docs/interfaces/KabelUtils.md +215 -0
- package/docs/interfaces/NodeEvents.md +42 -0
- package/docs/interfaces/NodeJson.md +104 -0
- package/docs/interfaces/NodePrototype.md +82 -0
- package/docs/interfaces/RegisteredEl.md +53 -0
- package/docs/interfaces/SerializedNode.md +128 -0
- package/docs/interfaces/TblxCategoryStruct.md +41 -0
- package/docs/interfaces/TblxFieldStruct.md +28 -0
- package/docs/interfaces/TblxNodeStruct.md +35 -0
- package/docs/interfaces/WidgetOptions.md +115 -0
- package/docs/interfaces/WidgetPrototypeList.md +15 -0
- package/docs/type-aliases/AnyField.md +13 -0
- package/docs/type-aliases/AnyFieldCls.md +13 -0
- package/docs/type-aliases/Color.md +13 -0
- package/docs/type-aliases/Connectable.md +13 -0
- package/docs/type-aliases/EventArgs.md +11 -0
- package/docs/type-aliases/EventSetupFn.md +25 -0
- package/docs/type-aliases/Hex.md +13 -0
- package/docs/type-aliases/RGBObject.md +37 -0
- package/docs/type-aliases/RGBString.md +13 -0
- package/docs/type-aliases/RGBTuple.md +13 -0
- package/docs/type-aliases/TblxObjStruct.md +52 -0
- package/docs/variables/CategoryColors.md +29 -0
- package/docs/variables/FieldMap.md +41 -0
- package/docs/variables/NodePrototypes.md +18 -0
- package/docs/variables/default.md +11 -0
- package/events/comment-drag-handle.ts +61 -0
- package/events/comment-input.ts +291 -0
- package/events/connection-line.ts +68 -0
- package/events/connector.ts +116 -0
- package/events/draggable.ts +119 -0
- package/events/events.ts +7 -0
- package/events/input-box.ts +213 -0
- package/events/node-x-btn.ts +25 -0
- package/index.d.ts +4 -0
- package/package.json +49 -0
- package/renderers/apollo/apollo.ts +21 -0
- package/renderers/apollo/constants.ts +40 -0
- package/renderers/apollo/renderer.ts +331 -0
- package/renderers/atlas/atlas.ts +15 -0
- package/renderers/constants.ts +87 -0
- package/renderers/renderer.ts +1288 -0
- package/renderers/representer-node.ts +52 -0
- package/renderers/representer.ts +25 -0
- package/src/category.ts +107 -0
- package/src/colors.ts +20 -0
- package/src/comment.ts +142 -0
- package/src/connection.ts +114 -0
- package/src/context-menu.ts +194 -0
- package/src/coordinates.ts +74 -0
- package/src/core.ts +202 -0
- package/src/ctx-menu-registry.ts +143 -0
- package/src/dropdown-menu.ts +215 -0
- package/src/field.ts +595 -0
- package/src/flyout.ts +165 -0
- package/src/fonts-manager.ts +38 -0
- package/src/grid.ts +162 -0
- package/src/headless-node.ts +27 -0
- package/src/index.ts +115 -0
- package/src/inject-headless.ts +18 -0
- package/src/inject.ts +213 -0
- package/src/main-workspace.ts +51 -0
- package/src/mutator.ts +40 -0
- package/src/node-types.ts +27 -0
- package/src/nodesvg.ts +756 -0
- package/src/prototypes.ts +9 -0
- package/src/renderer-map.ts +86 -0
- package/src/styles.css +224 -0
- package/src/toolbox.ts +125 -0
- package/src/types.ts +205 -0
- package/src/undo-redo.ts +87 -0
- package/src/visual-types.ts +29 -0
- package/src/widget-prototypes.ts +11 -0
- package/src/widget.ts +139 -0
- package/src/workspace-coords.ts +14 -0
- package/src/workspace-svg.ts +736 -0
- package/src/workspace.ts +155 -0
- package/test-server.js +61 -0
- package/themes/dark.ts +32 -0
- package/themes/default.ts +28 -0
- package/themes/themes.ts +9 -0
- package/tsconfig.json +25 -0
- package/typedoc.json +10 -0
- package/util/emitter.ts +33 -0
- package/util/env.ts +11 -0
- package/util/escape-html.ts +22 -0
- package/util/eventer.ts +108 -0
- package/util/has-prop.ts +4 -0
- package/util/parse-color.ts +42 -0
- package/util/path.ts +99 -0
- package/util/styler.ts +41 -0
- package/util/uid.ts +184 -0
- package/util/unescape-html.ts +22 -0
- package/util/user-state.ts +68 -0
- package/util/wait-anim-frames.ts +24 -0
- package/util/window-listeners.ts +62 -0
- package/webpack.config.js +80 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
[**Kabel Project Docs v1.0.6**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[Kabel Project Docs](../globals.md) / Connection
|
|
6
|
+
|
|
7
|
+
# Class: Connection
|
|
8
|
+
|
|
9
|
+
Defined in: [src/connection.ts:12](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/connection.ts#L12)
|
|
10
|
+
|
|
11
|
+
Represents a connection between two connectable objects.
|
|
12
|
+
|
|
13
|
+
## Constructors
|
|
14
|
+
|
|
15
|
+
### Constructor
|
|
16
|
+
|
|
17
|
+
> **new Connection**(`from`, `to`, `isPrevious`): `Connection`
|
|
18
|
+
|
|
19
|
+
Defined in: [src/connection.ts:26](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/connection.ts#L26)
|
|
20
|
+
|
|
21
|
+
Creates a new Connection.
|
|
22
|
+
|
|
23
|
+
#### Parameters
|
|
24
|
+
|
|
25
|
+
##### from
|
|
26
|
+
|
|
27
|
+
[`Connectable`](../type-aliases/Connectable.md)
|
|
28
|
+
|
|
29
|
+
The source NodeSvg or Field
|
|
30
|
+
|
|
31
|
+
##### to
|
|
32
|
+
|
|
33
|
+
[`Connectable`](../type-aliases/Connectable.md)
|
|
34
|
+
|
|
35
|
+
The target NodeSvg or Field
|
|
36
|
+
|
|
37
|
+
##### isPrevious
|
|
38
|
+
|
|
39
|
+
`boolean` = `false`
|
|
40
|
+
|
|
41
|
+
True if this connection is a previous connection
|
|
42
|
+
|
|
43
|
+
#### Returns
|
|
44
|
+
|
|
45
|
+
`Connection`
|
|
46
|
+
|
|
47
|
+
## Properties
|
|
48
|
+
|
|
49
|
+
### from
|
|
50
|
+
|
|
51
|
+
> **from**: [`Connectable`](../type-aliases/Connectable.md)
|
|
52
|
+
|
|
53
|
+
Defined in: [src/connection.ts:14](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/connection.ts#L14)
|
|
54
|
+
|
|
55
|
+
The source of the connection
|
|
56
|
+
|
|
57
|
+
***
|
|
58
|
+
|
|
59
|
+
### isPrevious
|
|
60
|
+
|
|
61
|
+
> **isPrevious**: `boolean`
|
|
62
|
+
|
|
63
|
+
Defined in: [src/connection.ts:18](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/connection.ts#L18)
|
|
64
|
+
|
|
65
|
+
Whether this connection represents a previous connection (affects rendering/logic)
|
|
66
|
+
|
|
67
|
+
***
|
|
68
|
+
|
|
69
|
+
### to
|
|
70
|
+
|
|
71
|
+
> **to**: [`Connectable`](../type-aliases/Connectable.md)
|
|
72
|
+
|
|
73
|
+
Defined in: [src/connection.ts:16](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/connection.ts#L16)
|
|
74
|
+
|
|
75
|
+
The target of the connection
|
|
76
|
+
|
|
77
|
+
## Methods
|
|
78
|
+
|
|
79
|
+
### disconnectFrom()
|
|
80
|
+
|
|
81
|
+
> **disconnectFrom**(): `void`
|
|
82
|
+
|
|
83
|
+
Defined in: [src/connection.ts:71](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/connection.ts#L71)
|
|
84
|
+
|
|
85
|
+
Disconnects this connection from its source.
|
|
86
|
+
Safely handles NodeSvg chains and ConnectableFields.
|
|
87
|
+
|
|
88
|
+
#### Returns
|
|
89
|
+
|
|
90
|
+
`void`
|
|
91
|
+
|
|
92
|
+
***
|
|
93
|
+
|
|
94
|
+
### disconnectTo()
|
|
95
|
+
|
|
96
|
+
> **disconnectTo**(): `void`
|
|
97
|
+
|
|
98
|
+
Defined in: [src/connection.ts:46](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/connection.ts#L46)
|
|
99
|
+
|
|
100
|
+
Disconnects this connection from its target.
|
|
101
|
+
Safely handles NodeSvg chains and ConnectableFields.
|
|
102
|
+
|
|
103
|
+
#### Returns
|
|
104
|
+
|
|
105
|
+
`void`
|
|
106
|
+
|
|
107
|
+
***
|
|
108
|
+
|
|
109
|
+
### getFrom()
|
|
110
|
+
|
|
111
|
+
> **getFrom**(): [`Connectable`](../type-aliases/Connectable.md)
|
|
112
|
+
|
|
113
|
+
Defined in: [src/connection.ts:38](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/connection.ts#L38)
|
|
114
|
+
|
|
115
|
+
Returns the source of the connection
|
|
116
|
+
|
|
117
|
+
#### Returns
|
|
118
|
+
|
|
119
|
+
[`Connectable`](../type-aliases/Connectable.md)
|
|
120
|
+
|
|
121
|
+
***
|
|
122
|
+
|
|
123
|
+
### getTo()
|
|
124
|
+
|
|
125
|
+
> **getTo**(): [`Connectable`](../type-aliases/Connectable.md)
|
|
126
|
+
|
|
127
|
+
Defined in: [src/connection.ts:33](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/connection.ts#L33)
|
|
128
|
+
|
|
129
|
+
Returns the target of the connection
|
|
130
|
+
|
|
131
|
+
#### Returns
|
|
132
|
+
|
|
133
|
+
[`Connectable`](../type-aliases/Connectable.md)
|
|
134
|
+
|
|
135
|
+
***
|
|
136
|
+
|
|
137
|
+
### isolate()
|
|
138
|
+
|
|
139
|
+
> **isolate**(): `void`
|
|
140
|
+
|
|
141
|
+
Defined in: [src/connection.ts:108](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/connection.ts#L108)
|
|
142
|
+
|
|
143
|
+
Completely isolates this connection, clearing both ends
|
|
144
|
+
|
|
145
|
+
#### Returns
|
|
146
|
+
|
|
147
|
+
`void`
|
|
148
|
+
|
|
149
|
+
***
|
|
150
|
+
|
|
151
|
+
### setFrom()
|
|
152
|
+
|
|
153
|
+
> **setFrom**(`source`): `void`
|
|
154
|
+
|
|
155
|
+
Defined in: [src/connection.ts:103](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/connection.ts#L103)
|
|
156
|
+
|
|
157
|
+
Sets the source of this connection (used during deserialization)
|
|
158
|
+
|
|
159
|
+
#### Parameters
|
|
160
|
+
|
|
161
|
+
##### source
|
|
162
|
+
|
|
163
|
+
[`Connectable`](../type-aliases/Connectable.md)
|
|
164
|
+
|
|
165
|
+
New connection source
|
|
166
|
+
|
|
167
|
+
#### Returns
|
|
168
|
+
|
|
169
|
+
`void`
|
|
170
|
+
|
|
171
|
+
***
|
|
172
|
+
|
|
173
|
+
### setTo()
|
|
174
|
+
|
|
175
|
+
> **setTo**(`target`): `void`
|
|
176
|
+
|
|
177
|
+
Defined in: [src/connection.ts:95](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/connection.ts#L95)
|
|
178
|
+
|
|
179
|
+
Sets the target of this connection (used during deserialization)
|
|
180
|
+
|
|
181
|
+
#### Parameters
|
|
182
|
+
|
|
183
|
+
##### target
|
|
184
|
+
|
|
185
|
+
[`Connectable`](../type-aliases/Connectable.md)
|
|
186
|
+
|
|
187
|
+
New connection target
|
|
188
|
+
|
|
189
|
+
#### Returns
|
|
190
|
+
|
|
191
|
+
`void`
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
[**Kabel Project Docs v1.0.6**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[Kabel Project Docs](../globals.md) / ContextMenuHTML
|
|
6
|
+
|
|
7
|
+
# Class: ContextMenuHTML
|
|
8
|
+
|
|
9
|
+
Defined in: [src/context-menu.ts:37](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/context-menu.ts#L37)
|
|
10
|
+
|
|
11
|
+
HTML context menu rendered on workspace right-click.
|
|
12
|
+
|
|
13
|
+
## Constructors
|
|
14
|
+
|
|
15
|
+
### Constructor
|
|
16
|
+
|
|
17
|
+
> **new ContextMenuHTML**(`workspace`): `ContextMenuHTML`
|
|
18
|
+
|
|
19
|
+
Defined in: [src/context-menu.ts:59](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/context-menu.ts#L59)
|
|
20
|
+
|
|
21
|
+
Create a new context menu for a workspace.
|
|
22
|
+
|
|
23
|
+
#### Parameters
|
|
24
|
+
|
|
25
|
+
##### workspace
|
|
26
|
+
|
|
27
|
+
[`WorkspaceSvg`](WorkspaceSvg.md)
|
|
28
|
+
|
|
29
|
+
Workspace to attach the context menu to
|
|
30
|
+
|
|
31
|
+
#### Returns
|
|
32
|
+
|
|
33
|
+
`ContextMenuHTML`
|
|
34
|
+
|
|
35
|
+
## Properties
|
|
36
|
+
|
|
37
|
+
### controller
|
|
38
|
+
|
|
39
|
+
> **controller**: [`WorkspaceController`](WorkspaceController.md)
|
|
40
|
+
|
|
41
|
+
Defined in: [src/context-menu.ts:45](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/context-menu.ts#L45)
|
|
42
|
+
|
|
43
|
+
The workspace's controller
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
### options
|
|
48
|
+
|
|
49
|
+
> **options**: `ContextMenuOpts`[]
|
|
50
|
+
|
|
51
|
+
Defined in: [src/context-menu.ts:53](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/context-menu.ts#L53)
|
|
52
|
+
|
|
53
|
+
Options for the context menu.
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### widget
|
|
58
|
+
|
|
59
|
+
> **widget**: [`Widget`](Widget.md)
|
|
60
|
+
|
|
61
|
+
Defined in: [src/context-menu.ts:49](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/context-menu.ts#L49)
|
|
62
|
+
|
|
63
|
+
The widget in the workspace to display the menu on.
|
|
64
|
+
|
|
65
|
+
***
|
|
66
|
+
|
|
67
|
+
### workspace
|
|
68
|
+
|
|
69
|
+
> **workspace**: [`WorkspaceSvg`](WorkspaceSvg.md)
|
|
70
|
+
|
|
71
|
+
Defined in: [src/context-menu.ts:41](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/context-menu.ts#L41)
|
|
72
|
+
|
|
73
|
+
The workspace.
|
|
74
|
+
|
|
75
|
+
## Accessors
|
|
76
|
+
|
|
77
|
+
### mousePos
|
|
78
|
+
|
|
79
|
+
#### Get Signature
|
|
80
|
+
|
|
81
|
+
> **get** **mousePos**(): `object`
|
|
82
|
+
|
|
83
|
+
Defined in: [src/context-menu.ts:154](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/context-menu.ts#L154)
|
|
84
|
+
|
|
85
|
+
Returns the current mouse position in workspace coordinates
|
|
86
|
+
|
|
87
|
+
##### Returns
|
|
88
|
+
|
|
89
|
+
`object`
|
|
90
|
+
|
|
91
|
+
###### x
|
|
92
|
+
|
|
93
|
+
> **x**: `number`
|
|
94
|
+
|
|
95
|
+
###### y
|
|
96
|
+
|
|
97
|
+
> **y**: `number`
|
|
98
|
+
|
|
99
|
+
***
|
|
100
|
+
|
|
101
|
+
### target
|
|
102
|
+
|
|
103
|
+
#### Get Signature
|
|
104
|
+
|
|
105
|
+
> **get** **target**(): [`NodeSvg`](NodeSvg.md) \| [`WorkspaceSvg`](WorkspaceSvg.md) \| `HTMLElement` \| [`CommentModel`](CommentModel.md) \| `null`
|
|
106
|
+
|
|
107
|
+
Defined in: [src/context-menu.ts:161](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/context-menu.ts#L161)
|
|
108
|
+
|
|
109
|
+
Returns the target element under the mouse for context menu.
|
|
110
|
+
|
|
111
|
+
##### Returns
|
|
112
|
+
|
|
113
|
+
[`NodeSvg`](NodeSvg.md) \| [`WorkspaceSvg`](WorkspaceSvg.md) \| `HTMLElement` \| [`CommentModel`](CommentModel.md) \| `null`
|
|
114
|
+
|
|
115
|
+
## Methods
|
|
116
|
+
|
|
117
|
+
### hide()
|
|
118
|
+
|
|
119
|
+
> **hide**(): `void`
|
|
120
|
+
|
|
121
|
+
Defined in: [src/context-menu.ts:149](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/context-menu.ts#L149)
|
|
122
|
+
|
|
123
|
+
Hides the context menu
|
|
124
|
+
|
|
125
|
+
#### Returns
|
|
126
|
+
|
|
127
|
+
`void`
|
|
128
|
+
|
|
129
|
+
***
|
|
130
|
+
|
|
131
|
+
### initListeners()
|
|
132
|
+
|
|
133
|
+
> **initListeners**(): `void`
|
|
134
|
+
|
|
135
|
+
Defined in: [src/context-menu.ts:125](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/context-menu.ts#L125)
|
|
136
|
+
|
|
137
|
+
Initializes event listeners for showing/hiding the menu.
|
|
138
|
+
|
|
139
|
+
#### Returns
|
|
140
|
+
|
|
141
|
+
`void`
|
|
142
|
+
|
|
143
|
+
***
|
|
144
|
+
|
|
145
|
+
### renderOptions()
|
|
146
|
+
|
|
147
|
+
> **renderOptions**(`target`): `void`
|
|
148
|
+
|
|
149
|
+
Defined in: [src/context-menu.ts:91](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/context-menu.ts#L91)
|
|
150
|
+
|
|
151
|
+
Renders context menu options for a given target.
|
|
152
|
+
|
|
153
|
+
#### Parameters
|
|
154
|
+
|
|
155
|
+
##### target
|
|
156
|
+
|
|
157
|
+
The object the context menu is for
|
|
158
|
+
|
|
159
|
+
[`NodeSvg`](NodeSvg.md) | [`WorkspaceSvg`](WorkspaceSvg.md) | `HTMLElement` | [`CommentModel`](CommentModel.md) | `null`
|
|
160
|
+
|
|
161
|
+
#### Returns
|
|
162
|
+
|
|
163
|
+
`void`
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
[**Kabel Project Docs v1.0.6**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[Kabel Project Docs](../globals.md) / Coordinates
|
|
6
|
+
|
|
7
|
+
# Class: Coordinates
|
|
8
|
+
|
|
9
|
+
Defined in: [src/coordinates.ts:4](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/coordinates.ts#L4)
|
|
10
|
+
|
|
11
|
+
Represents a 2D coordinate in space.
|
|
12
|
+
|
|
13
|
+
## Extended by
|
|
14
|
+
|
|
15
|
+
- [`WorkspaceCoords`](WorkspaceCoords.md)
|
|
16
|
+
|
|
17
|
+
## Constructors
|
|
18
|
+
|
|
19
|
+
### Constructor
|
|
20
|
+
|
|
21
|
+
> **new Coordinates**(`x`, `y`): `Coordinates`
|
|
22
|
+
|
|
23
|
+
Defined in: [src/coordinates.ts:15](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/coordinates.ts#L15)
|
|
24
|
+
|
|
25
|
+
Creates a new Coordinates instance
|
|
26
|
+
|
|
27
|
+
#### Parameters
|
|
28
|
+
|
|
29
|
+
##### x
|
|
30
|
+
|
|
31
|
+
`number` = `0`
|
|
32
|
+
|
|
33
|
+
The x value (default 0)
|
|
34
|
+
|
|
35
|
+
##### y
|
|
36
|
+
|
|
37
|
+
`number` = `0`
|
|
38
|
+
|
|
39
|
+
The y value (default 0)
|
|
40
|
+
|
|
41
|
+
#### Returns
|
|
42
|
+
|
|
43
|
+
`Coordinates`
|
|
44
|
+
|
|
45
|
+
## Properties
|
|
46
|
+
|
|
47
|
+
### x
|
|
48
|
+
|
|
49
|
+
> **x**: `number`
|
|
50
|
+
|
|
51
|
+
Defined in: [src/coordinates.ts:6](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/coordinates.ts#L6)
|
|
52
|
+
|
|
53
|
+
X position
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### y
|
|
58
|
+
|
|
59
|
+
> **y**: `number`
|
|
60
|
+
|
|
61
|
+
Defined in: [src/coordinates.ts:8](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/coordinates.ts#L8)
|
|
62
|
+
|
|
63
|
+
Y position
|
|
64
|
+
|
|
65
|
+
## Methods
|
|
66
|
+
|
|
67
|
+
### clone()
|
|
68
|
+
|
|
69
|
+
> **clone**(): `Coordinates`
|
|
70
|
+
|
|
71
|
+
Defined in: [src/coordinates.ts:34](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/coordinates.ts#L34)
|
|
72
|
+
|
|
73
|
+
Returns a copy of this coordinate
|
|
74
|
+
|
|
75
|
+
#### Returns
|
|
76
|
+
|
|
77
|
+
`Coordinates`
|
|
78
|
+
|
|
79
|
+
A new Coordinates instance with the same x and y
|
|
80
|
+
|
|
81
|
+
***
|
|
82
|
+
|
|
83
|
+
### distanceTo()
|
|
84
|
+
|
|
85
|
+
> **distanceTo**(`other`): `number`
|
|
86
|
+
|
|
87
|
+
Defined in: [src/coordinates.ts:43](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/coordinates.ts#L43)
|
|
88
|
+
|
|
89
|
+
Calculate the Euclidean distance to another coordinate
|
|
90
|
+
|
|
91
|
+
#### Parameters
|
|
92
|
+
|
|
93
|
+
##### other
|
|
94
|
+
|
|
95
|
+
`Coordinates`
|
|
96
|
+
|
|
97
|
+
The target coordinate
|
|
98
|
+
|
|
99
|
+
#### Returns
|
|
100
|
+
|
|
101
|
+
`number`
|
|
102
|
+
|
|
103
|
+
The distance as a number
|
|
104
|
+
|
|
105
|
+
***
|
|
106
|
+
|
|
107
|
+
### set()
|
|
108
|
+
|
|
109
|
+
> **set**(`x`, `y`): `void`
|
|
110
|
+
|
|
111
|
+
Defined in: [src/coordinates.ts:25](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/coordinates.ts#L25)
|
|
112
|
+
|
|
113
|
+
Set the coordinates to new values
|
|
114
|
+
|
|
115
|
+
#### Parameters
|
|
116
|
+
|
|
117
|
+
##### x
|
|
118
|
+
|
|
119
|
+
`number`
|
|
120
|
+
|
|
121
|
+
The new x value
|
|
122
|
+
|
|
123
|
+
##### y
|
|
124
|
+
|
|
125
|
+
`number`
|
|
126
|
+
|
|
127
|
+
The new y value
|
|
128
|
+
|
|
129
|
+
#### Returns
|
|
130
|
+
|
|
131
|
+
`void`
|
|
132
|
+
|
|
133
|
+
***
|
|
134
|
+
|
|
135
|
+
### toArray()
|
|
136
|
+
|
|
137
|
+
> **toArray**(): \[`number`, `number`\]
|
|
138
|
+
|
|
139
|
+
Defined in: [src/coordinates.ts:61](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/coordinates.ts#L61)
|
|
140
|
+
|
|
141
|
+
Convert the coordinate to an array [x, y]
|
|
142
|
+
|
|
143
|
+
#### Returns
|
|
144
|
+
|
|
145
|
+
\[`number`, `number`\]
|
|
146
|
+
|
|
147
|
+
Tuple of numbers [x, y]
|
|
148
|
+
|
|
149
|
+
***
|
|
150
|
+
|
|
151
|
+
### toObject()
|
|
152
|
+
|
|
153
|
+
> **toObject**(): `object`
|
|
154
|
+
|
|
155
|
+
Defined in: [src/coordinates.ts:69](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/coordinates.ts#L69)
|
|
156
|
+
|
|
157
|
+
Convert the coordinate to an object { x, y }
|
|
158
|
+
|
|
159
|
+
#### Returns
|
|
160
|
+
|
|
161
|
+
`object`
|
|
162
|
+
|
|
163
|
+
Object with x and y properties
|
|
164
|
+
|
|
165
|
+
##### x
|
|
166
|
+
|
|
167
|
+
> **x**: `number`
|
|
168
|
+
|
|
169
|
+
##### y
|
|
170
|
+
|
|
171
|
+
> **y**: `number`
|
|
172
|
+
|
|
173
|
+
***
|
|
174
|
+
|
|
175
|
+
### toString()
|
|
176
|
+
|
|
177
|
+
> **toString**(): `string`
|
|
178
|
+
|
|
179
|
+
Defined in: [src/coordinates.ts:53](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/coordinates.ts#L53)
|
|
180
|
+
|
|
181
|
+
Convert the coordinate to a string representation
|
|
182
|
+
|
|
183
|
+
#### Returns
|
|
184
|
+
|
|
185
|
+
`string`
|
|
186
|
+
|
|
187
|
+
A string like "(x, y)"
|