@elicdavis/node-flow 0.2.3 → 0.2.5
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/index.d.mts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +146 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +143 -19
- package/dist/index.mjs.map +1 -1
- package/index.html +2 -1
- package/package.json +1 -1
- package/src/contextMenu.ts +3 -3
- package/src/graph.ts +39 -5
- package/src/index.ts +6 -6
- package/src/input.ts +16 -0
- package/src/markdown/syntaxParser.ts +2 -2
- package/src/node.ts +29 -0
- package/src/nodes/publisher.ts +6 -8
- package/src/nodes/subsystem.ts +43 -5
- package/src/port.ts +31 -0
- package/src/quickMenu.ts +11 -0
- package/src/theme.ts +3 -1
- package/test/markdown.test.ts +11 -0
- package/test/markdown_code_block.test.ts +21 -1
- package/test/mouse_leave.test.ts +70 -0
- package/test/node_hover.test.ts +69 -0
- package/test/node_menu_filter.test.ts +24 -0
- package/test/port.test.ts +49 -1
package/dist/index.js
CHANGED
|
@@ -58,12 +58,15 @@ __export(index_exports, {
|
|
|
58
58
|
formatNumber: () => formatNumber,
|
|
59
59
|
onThemeChange: () => onThemeChange,
|
|
60
60
|
portConfigTypes: () => portConfigTypes,
|
|
61
|
+
portTypeColor: () => portTypeColor,
|
|
61
62
|
portsCompatible: () => portsCompatible,
|
|
63
|
+
portsConnect: () => portsConnect,
|
|
62
64
|
renderContinuously: () => renderContinuously,
|
|
63
65
|
requestRender: () => requestRender,
|
|
64
66
|
setTheme: () => setTheme,
|
|
65
67
|
themeVersion: () => themeVersion,
|
|
66
68
|
typeSetsCompatible: () => typeSetsCompatible,
|
|
69
|
+
typeSetsConnect: () => typeSetsConnect,
|
|
67
70
|
widgetFont: () => widgetFont
|
|
68
71
|
});
|
|
69
72
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -125,7 +128,8 @@ var defaults = {
|
|
|
125
128
|
Idle: "#1c1c1c",
|
|
126
129
|
MouseOver: "#8e8e8e",
|
|
127
130
|
Grabbed: "white",
|
|
128
|
-
Selected: "#6e6e6e"
|
|
131
|
+
Selected: "#6e6e6e",
|
|
132
|
+
Highlighted: "#ffc95c"
|
|
129
133
|
},
|
|
130
134
|
Bevel: null,
|
|
131
135
|
Port: {
|
|
@@ -212,6 +216,7 @@ var defaults = {
|
|
|
212
216
|
H3: {
|
|
213
217
|
FontSize: 16
|
|
214
218
|
},
|
|
219
|
+
CodeFontFamily: null,
|
|
215
220
|
CodeBlock: {
|
|
216
221
|
BackgroundColor: "#0c2b35",
|
|
217
222
|
FontColor: "#afb9bb",
|
|
@@ -661,11 +666,11 @@ var ContextMenu = class _ContextMenu {
|
|
|
661
666
|
#tempBox = { Position: Zero(), Size: Zero() };
|
|
662
667
|
#openSubMenu;
|
|
663
668
|
#bounds = null;
|
|
664
|
-
|
|
669
|
+
contains(point) {
|
|
665
670
|
if (this.#bounds !== null && InBox(this.#bounds, point)) {
|
|
666
671
|
return true;
|
|
667
672
|
}
|
|
668
|
-
return this.#openSubMenu !== void 0 && this.#openSubMenu
|
|
673
|
+
return this.#openSubMenu !== void 0 && this.#openSubMenu.contains(point);
|
|
669
674
|
}
|
|
670
675
|
/**
|
|
671
676
|
* A submenu is anchored to its parent's left edge and told the parent's
|
|
@@ -708,7 +713,7 @@ var ContextMenu = class _ContextMenu {
|
|
|
708
713
|
Position: { x: position.x, y: position.y },
|
|
709
714
|
Size: { x: scaledEntryWidth, y: totalScaledHeight }
|
|
710
715
|
};
|
|
711
|
-
const pointer = mousePosition !== void 0 && this.#openSubMenu !== void 0 && this.#openSubMenu
|
|
716
|
+
const pointer = mousePosition !== void 0 && this.#openSubMenu !== void 0 && this.#openSubMenu.contains(mousePosition) ? void 0 : mousePosition;
|
|
712
717
|
this.#tempBox.Size.x = scaledEntryWidth;
|
|
713
718
|
this.#tempBox.Size.y = scaledEntryHeight;
|
|
714
719
|
CopyVector2(this.#tempBox.Position, position);
|
|
@@ -818,12 +823,14 @@ var MouseObserver = class {
|
|
|
818
823
|
#clickStop;
|
|
819
824
|
#contextMenu;
|
|
820
825
|
#zoomCallback;
|
|
826
|
+
#leaveCallback;
|
|
827
|
+
#inside = false;
|
|
821
828
|
#longPressTimer = null;
|
|
822
829
|
#longPressOrigin = Zero();
|
|
823
830
|
#longPressFired = false;
|
|
824
831
|
#pinchDist = 0;
|
|
825
832
|
#lastTouchAt = 0;
|
|
826
|
-
constructor(ele, dragCallback, moveCallback, clickStart, clickStop, contextMenu, fileDrop, zoomCallback) {
|
|
833
|
+
constructor(ele, dragCallback, moveCallback, clickStart, clickStop, contextMenu, fileDrop, zoomCallback, leaveCallback) {
|
|
827
834
|
this.#ele = ele;
|
|
828
835
|
this.#dragCallback = dragCallback;
|
|
829
836
|
this.#moveCallback = moveCallback;
|
|
@@ -831,6 +838,7 @@ var MouseObserver = class {
|
|
|
831
838
|
this.#clickStop = clickStop;
|
|
832
839
|
this.#contextMenu = contextMenu;
|
|
833
840
|
this.#zoomCallback = zoomCallback;
|
|
841
|
+
this.#leaveCallback = leaveCallback;
|
|
834
842
|
this.#clicked = false;
|
|
835
843
|
this.#lastTouch = Zero();
|
|
836
844
|
this.#lastMousePosition = Zero();
|
|
@@ -845,6 +853,12 @@ var MouseObserver = class {
|
|
|
845
853
|
document.addEventListener("touchend", redraws(this.#touchEnd.bind(this)), false);
|
|
846
854
|
document.addEventListener("touchcancel", redraws(this.#touchEnd.bind(this)), false);
|
|
847
855
|
ele.addEventListener("mousemove", redraws(this.#move.bind(this)), false);
|
|
856
|
+
ele.addEventListener("mouseleave", redraws(() => {
|
|
857
|
+
this.#inside = false;
|
|
858
|
+
if (!this.#clicked) {
|
|
859
|
+
this.#leaveCallback?.();
|
|
860
|
+
}
|
|
861
|
+
}), false);
|
|
848
862
|
ele.addEventListener("touchmove", redraws(this.#touchMove.bind(this)), { passive: false });
|
|
849
863
|
ele.addEventListener("wheel", redraws(this.#wheel.bind(this)), { passive: false });
|
|
850
864
|
ele.addEventListener("drop", redraws((ev) => {
|
|
@@ -914,6 +928,7 @@ var MouseObserver = class {
|
|
|
914
928
|
if (this.#fromTouch()) {
|
|
915
929
|
return;
|
|
916
930
|
}
|
|
931
|
+
this.#inside = true;
|
|
917
932
|
const pos = this.#mousePos(event);
|
|
918
933
|
if (this.#clicked) {
|
|
919
934
|
const delta = Zero();
|
|
@@ -927,6 +942,7 @@ var MouseObserver = class {
|
|
|
927
942
|
if (event.button !== 0 || this.#fromTouch()) {
|
|
928
943
|
return;
|
|
929
944
|
}
|
|
945
|
+
this.#inside = true;
|
|
930
946
|
this.#clicked = true;
|
|
931
947
|
this.#clickStart(this.#mousePos(event), event.ctrlKey || event.shiftKey);
|
|
932
948
|
}
|
|
@@ -934,8 +950,12 @@ var MouseObserver = class {
|
|
|
934
950
|
if (event.button !== 0 || this.#fromTouch()) {
|
|
935
951
|
return;
|
|
936
952
|
}
|
|
953
|
+
const wasClicked = this.#clicked;
|
|
937
954
|
this.#clicked = false;
|
|
938
955
|
this.#clickStop();
|
|
956
|
+
if (wasClicked && !this.#inside) {
|
|
957
|
+
this.#leaveCallback?.();
|
|
958
|
+
}
|
|
939
959
|
}
|
|
940
960
|
#touchStart(event) {
|
|
941
961
|
this.#lastTouchAt = Date.now();
|
|
@@ -1625,6 +1645,18 @@ function typeSetsCompatible(a, b) {
|
|
|
1625
1645
|
}
|
|
1626
1646
|
return a.some((type) => b.includes(type));
|
|
1627
1647
|
}
|
|
1648
|
+
function portsConnect(output, input, casts) {
|
|
1649
|
+
if (!output || !input) {
|
|
1650
|
+
return false;
|
|
1651
|
+
}
|
|
1652
|
+
return typeSetsConnect(output.acceptedTypes(), input.acceptedTypes(), casts);
|
|
1653
|
+
}
|
|
1654
|
+
function typeSetsConnect(output, input, casts) {
|
|
1655
|
+
if (typeSetsCompatible(output, input)) {
|
|
1656
|
+
return true;
|
|
1657
|
+
}
|
|
1658
|
+
return (casts ?? []).some((cast) => output.includes(cast.from) && input.includes(cast.to));
|
|
1659
|
+
}
|
|
1628
1660
|
function portConfigTypes(config) {
|
|
1629
1661
|
if (config.anyType === true) {
|
|
1630
1662
|
return [];
|
|
@@ -1661,6 +1693,9 @@ function fallbackColor(type, s) {
|
|
|
1661
1693
|
HSV2RGB(hsv, color);
|
|
1662
1694
|
return RgbToHex(color);
|
|
1663
1695
|
}
|
|
1696
|
+
function portTypeColor(type) {
|
|
1697
|
+
return fallbackColor(type, 1);
|
|
1698
|
+
}
|
|
1664
1699
|
var Port = class {
|
|
1665
1700
|
#node;
|
|
1666
1701
|
#displayName;
|
|
@@ -3969,11 +4004,10 @@ function TimeExecution(name, callback) {
|
|
|
3969
4004
|
|
|
3970
4005
|
// src/nodes/publisher.ts
|
|
3971
4006
|
function offersMatchingPort(config, filter) {
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
return false;
|
|
4007
|
+
if (filter.needs === "INPUT" /* Input */) {
|
|
4008
|
+
return (config.inputs ?? []).some((port) => typeSetsConnect(filter.types, portConfigTypes(port), filter.casts));
|
|
3975
4009
|
}
|
|
3976
|
-
return
|
|
4010
|
+
return (config.outputs ?? []).some((port) => typeSetsConnect(portConfigTypes(port), filter.types, filter.casts));
|
|
3977
4011
|
}
|
|
3978
4012
|
var Publisher = class {
|
|
3979
4013
|
#name;
|
|
@@ -4154,11 +4188,14 @@ var NodeSubsystem2 = class {
|
|
|
4154
4188
|
#boxSelectStart_graphSpace;
|
|
4155
4189
|
#boxSelectEnd_graphSpace;
|
|
4156
4190
|
#boxSelectionNodes;
|
|
4191
|
+
#casts;
|
|
4157
4192
|
#lastCtx;
|
|
4158
4193
|
#lastMousePosition;
|
|
4159
4194
|
// LISTENERS ==============================================================
|
|
4160
4195
|
#nodeRemovedCallbacks;
|
|
4161
4196
|
#registeredNodeAddedCallbacks;
|
|
4197
|
+
#nodeHoverCallbacks = new Array();
|
|
4198
|
+
#hoveredNode = null;
|
|
4162
4199
|
// ========================================================================
|
|
4163
4200
|
constructor(postProcessPass, config) {
|
|
4164
4201
|
this.#postProcessPass = postProcessPass;
|
|
@@ -4180,6 +4217,13 @@ var NodeSubsystem2 = class {
|
|
|
4180
4217
|
this.#boxSelectEnd_graphSpace = Zero();
|
|
4181
4218
|
this.#boxSelectionNodes = new List();
|
|
4182
4219
|
this.#lastCtx = null;
|
|
4220
|
+
this.#casts = config?.casts ?? [];
|
|
4221
|
+
}
|
|
4222
|
+
setCasts(casts) {
|
|
4223
|
+
this.#casts = casts;
|
|
4224
|
+
}
|
|
4225
|
+
casts() {
|
|
4226
|
+
return this.#casts;
|
|
4183
4227
|
}
|
|
4184
4228
|
addPublisher(identifier, publisher) {
|
|
4185
4229
|
this.#nodeFactory.addPublisher(identifier, publisher);
|
|
@@ -4202,6 +4246,18 @@ var NodeSubsystem2 = class {
|
|
|
4202
4246
|
}
|
|
4203
4247
|
this.#nodeRemovedCallbacks.push(callback);
|
|
4204
4248
|
}
|
|
4249
|
+
addNodeHoverListener(callback) {
|
|
4250
|
+
this.#nodeHoverCallbacks.push(callback);
|
|
4251
|
+
}
|
|
4252
|
+
#setHoveredNode(node) {
|
|
4253
|
+
if (this.#hoveredNode === node) {
|
|
4254
|
+
return;
|
|
4255
|
+
}
|
|
4256
|
+
this.#hoveredNode = node;
|
|
4257
|
+
for (let i = 0; i < this.#nodeHoverCallbacks.length; i++) {
|
|
4258
|
+
this.#nodeHoverCallbacks[i](node);
|
|
4259
|
+
}
|
|
4260
|
+
}
|
|
4205
4261
|
clickStart(mousePosition, camera, ctrlKey) {
|
|
4206
4262
|
this.#boxSelect = false;
|
|
4207
4263
|
this.#nodesGrabbed.Clear();
|
|
@@ -4421,7 +4477,8 @@ var NodeSubsystem2 = class {
|
|
|
4421
4477
|
let firstHidden = -1;
|
|
4422
4478
|
for (let i = 0; i < count; i++) {
|
|
4423
4479
|
const port = side === "INPUT" /* Input */ ? node.inputPort(i) : node.outputPort(i);
|
|
4424
|
-
|
|
4480
|
+
const compatible = side === "INPUT" /* Input */ ? portsConnect(against, port, this.#casts) : portsConnect(port, against, this.#casts);
|
|
4481
|
+
if (!compatible) {
|
|
4425
4482
|
continue;
|
|
4426
4483
|
}
|
|
4427
4484
|
if (!port.hidden()) {
|
|
@@ -4478,11 +4535,11 @@ var NodeSubsystem2 = class {
|
|
|
4478
4535
|
this.#clearCurrentlySelectedConnection();
|
|
4479
4536
|
return;
|
|
4480
4537
|
}
|
|
4481
|
-
if (this.#portHovering.InputPort && !
|
|
4538
|
+
if (this.#portHovering.InputPort && !portsConnect(conn.outPort(), this.#portHovering.Port, this.#casts)) {
|
|
4482
4539
|
this.#clearCurrentlySelectedConnection();
|
|
4483
4540
|
return;
|
|
4484
4541
|
}
|
|
4485
|
-
if (!this.#portHovering.InputPort && !
|
|
4542
|
+
if (!this.#portHovering.InputPort && !portsConnect(this.#portHovering.Port, conn.inPort(), this.#casts)) {
|
|
4486
4543
|
this.#clearCurrentlySelectedConnection();
|
|
4487
4544
|
return;
|
|
4488
4545
|
}
|
|
@@ -4505,7 +4562,7 @@ var NodeSubsystem2 = class {
|
|
|
4505
4562
|
connectNodes(nodeOut, outPort, nodeIn, inPort) {
|
|
4506
4563
|
const from = nodeOut.outputPort(outPort);
|
|
4507
4564
|
const to = nodeIn.inputPort(inPort);
|
|
4508
|
-
if (!
|
|
4565
|
+
if (!portsConnect(from, to, this.#casts)) {
|
|
4509
4566
|
console.error("can't connect nodes of different types", from.getDataType(), to.getDataType());
|
|
4510
4567
|
return;
|
|
4511
4568
|
}
|
|
@@ -4848,6 +4905,7 @@ var NodeSubsystem2 = class {
|
|
|
4848
4905
|
this.#widgetHovering = null;
|
|
4849
4906
|
this.#nodeHovering = -1;
|
|
4850
4907
|
this.#boxSelectionNodes.Clear();
|
|
4908
|
+
let hovered = null;
|
|
4851
4909
|
const selectedBox_Screenspace = this.#boxSelectionScreenspaceBox(camera);
|
|
4852
4910
|
const canvas = {
|
|
4853
4911
|
Position: { x: 0, y: 0 },
|
|
@@ -4861,6 +4919,9 @@ var NodeSubsystem2 = class {
|
|
|
4861
4919
|
}
|
|
4862
4920
|
if (mousePosition !== void 0 && !this.#boxSelect) {
|
|
4863
4921
|
const intersection = this.#nodes[i].inBounds(ctx, camera, mousePosition);
|
|
4922
|
+
if (intersection.Node !== void 0) {
|
|
4923
|
+
hovered = intersection.Node;
|
|
4924
|
+
}
|
|
4864
4925
|
if (intersection.Node !== void 0 && intersection.PortIndex === void 0 && intersection.Widget === void 0) {
|
|
4865
4926
|
state = 1 /* MouseOver */;
|
|
4866
4927
|
this.#nodeHovering = i;
|
|
@@ -4892,6 +4953,7 @@ var NodeSubsystem2 = class {
|
|
|
4892
4953
|
}
|
|
4893
4954
|
this.#nodes[i].render(ctx, camera, state, mousePosition, this.#postProcessPass);
|
|
4894
4955
|
}
|
|
4956
|
+
this.#setHoveredNode(hovered);
|
|
4895
4957
|
if (this.#widgetCurrentlyClicking !== null) {
|
|
4896
4958
|
this.#cursor = this.#widgetCurrentlyClicking.Cursor?.() ?? "pointer" /* Pointer */;
|
|
4897
4959
|
}
|
|
@@ -5197,6 +5259,7 @@ var FlowNode = class {
|
|
|
5197
5259
|
#elementSpacing;
|
|
5198
5260
|
// Runtime ================================================================
|
|
5199
5261
|
#selected;
|
|
5262
|
+
#highlighted = false;
|
|
5200
5263
|
#inputPortPositions;
|
|
5201
5264
|
#outputPortPositions;
|
|
5202
5265
|
#widgetPositions;
|
|
@@ -5300,6 +5363,16 @@ var FlowNode = class {
|
|
|
5300
5363
|
this.#onSelect[i]();
|
|
5301
5364
|
}
|
|
5302
5365
|
}
|
|
5366
|
+
highlighted() {
|
|
5367
|
+
return this.#highlighted;
|
|
5368
|
+
}
|
|
5369
|
+
setHighlighted(highlighted) {
|
|
5370
|
+
if (this.#highlighted === highlighted) {
|
|
5371
|
+
return;
|
|
5372
|
+
}
|
|
5373
|
+
this.#highlighted = highlighted;
|
|
5374
|
+
requestRender();
|
|
5375
|
+
}
|
|
5303
5376
|
raiseDragStoppedEvent() {
|
|
5304
5377
|
for (let i = 0; i < this.#onDragStop.length; i++) {
|
|
5305
5378
|
this.#onDragStop[i](this);
|
|
@@ -5997,6 +6070,22 @@ var FlowNode = class {
|
|
|
5997
6070
|
const nodeBounds = this.calculateBounds(ctx, camera);
|
|
5998
6071
|
const nodeStyle = this.#calculateStyle(state);
|
|
5999
6072
|
nodeStyle.Draw(ctx, nodeBounds, camera.zoom);
|
|
6073
|
+
if (this.#highlighted) {
|
|
6074
|
+
const gap = 3;
|
|
6075
|
+
ctx.save();
|
|
6076
|
+
ctx.strokeStyle = Theme.Node.Border.Highlighted;
|
|
6077
|
+
ctx.lineWidth = 2;
|
|
6078
|
+
ctx.beginPath();
|
|
6079
|
+
ctx.roundRect(
|
|
6080
|
+
nodeBounds.Position.x - gap,
|
|
6081
|
+
nodeBounds.Position.y - gap,
|
|
6082
|
+
nodeBounds.Size.x + gap * 2,
|
|
6083
|
+
nodeBounds.Size.y + gap * 2,
|
|
6084
|
+
nodeStyle.radius() * camera.zoom + gap
|
|
6085
|
+
);
|
|
6086
|
+
ctx.stroke();
|
|
6087
|
+
ctx.restore();
|
|
6088
|
+
}
|
|
6000
6089
|
const borderSize = nodeStyle.borderSize();
|
|
6001
6090
|
ctx.textAlign = "center" /* Center */;
|
|
6002
6091
|
ctx.textBaseline = "middle" /* Middle */;
|
|
@@ -6702,7 +6791,7 @@ var MarkdownSyntaxParser = class {
|
|
|
6702
6791
|
content += token.lexeme();
|
|
6703
6792
|
this.#inc();
|
|
6704
6793
|
}
|
|
6705
|
-
return [new Text(content, { font: "monospace" })];
|
|
6794
|
+
return [new Text(content, { font: Theme.Note.CodeFontFamily ?? "monospace" })];
|
|
6706
6795
|
}
|
|
6707
6796
|
#text() {
|
|
6708
6797
|
let contents = new Array();
|
|
@@ -6816,7 +6905,7 @@ var MarkdownSyntaxParser = class {
|
|
|
6816
6905
|
this.#inc();
|
|
6817
6906
|
this.#inc();
|
|
6818
6907
|
const codeBlockText = this.#originalText.substring(start, end).replace(/\r?\n$/, "");
|
|
6819
|
-
const entryText = new Text(codeBlockText);
|
|
6908
|
+
const entryText = new Text(codeBlockText, { font: Theme.Note.CodeFontFamily ?? void 0 });
|
|
6820
6909
|
this.#assignStandardStyling([entryText]);
|
|
6821
6910
|
entryText.setColor(Theme.Note.CodeBlock.FontColor);
|
|
6822
6911
|
return new CodeBlockEntry(entryText);
|
|
@@ -7578,8 +7667,16 @@ var QuickMenu = class {
|
|
|
7578
7667
|
pos.x = 0;
|
|
7579
7668
|
}
|
|
7580
7669
|
this.#container.render(ctx, pos, 1, this.renderSize);
|
|
7670
|
+
this.#bounds = {
|
|
7671
|
+
Position: { x: pos.x, y: pos.y },
|
|
7672
|
+
Size: { x: this.renderSize.x, y: this.renderSize.y }
|
|
7673
|
+
};
|
|
7581
7674
|
return null;
|
|
7582
7675
|
}
|
|
7676
|
+
#bounds = null;
|
|
7677
|
+
contains(point) {
|
|
7678
|
+
return this.#bounds !== null && InBox(this.#bounds, point);
|
|
7679
|
+
}
|
|
7583
7680
|
};
|
|
7584
7681
|
|
|
7585
7682
|
// src/minimap.ts
|
|
@@ -7790,6 +7887,7 @@ var NodeFlowGraph = class {
|
|
|
7790
7887
|
#backgroundRenderer;
|
|
7791
7888
|
#contextMenuConfig;
|
|
7792
7889
|
#mousePosition;
|
|
7890
|
+
#mouseOverCanvas = false;
|
|
7793
7891
|
#camera;
|
|
7794
7892
|
#openedContextMenu;
|
|
7795
7893
|
#openQuickMenu;
|
|
@@ -7802,7 +7900,8 @@ var NodeFlowGraph = class {
|
|
|
7802
7900
|
const postProcessPass = new PassSubsystem();
|
|
7803
7901
|
this.#mainNodeSubsystem = new NodeSubsystem2(postProcessPass, {
|
|
7804
7902
|
nodes: config?.nodes,
|
|
7805
|
-
idleConnection: config?.idleConnection
|
|
7903
|
+
idleConnection: config?.idleConnection,
|
|
7904
|
+
casts: config?.casts
|
|
7806
7905
|
});
|
|
7807
7906
|
this.#lastFrameCursor = "default" /* Default */;
|
|
7808
7907
|
this.#cursor = "default" /* Default */;
|
|
@@ -7851,6 +7950,7 @@ var NodeFlowGraph = class {
|
|
|
7851
7950
|
this.#mouseDragEvent.bind(this),
|
|
7852
7951
|
(mousePosition) => {
|
|
7853
7952
|
this.#mousePosition = mousePosition;
|
|
7953
|
+
this.#mouseOverCanvas = true;
|
|
7854
7954
|
},
|
|
7855
7955
|
this.#clickStart.bind(this),
|
|
7856
7956
|
this.#clickEnd.bind(this),
|
|
@@ -7858,6 +7958,9 @@ var NodeFlowGraph = class {
|
|
|
7858
7958
|
this.#fileDrop.bind(this),
|
|
7859
7959
|
(factor, anchor) => {
|
|
7860
7960
|
this.#zoomBy(factor, anchor);
|
|
7961
|
+
},
|
|
7962
|
+
() => {
|
|
7963
|
+
this.#mouseOverCanvas = false;
|
|
7861
7964
|
}
|
|
7862
7965
|
);
|
|
7863
7966
|
document.addEventListener(
|
|
@@ -8015,6 +8118,7 @@ var NodeFlowGraph = class {
|
|
|
8015
8118
|
this.#openQuickMenu = null;
|
|
8016
8119
|
this.#contextMenuEntryHovering = null;
|
|
8017
8120
|
this.#mousePosition = mousePosition;
|
|
8121
|
+
this.#mouseOverCanvas = true;
|
|
8018
8122
|
if (this.#minimap.contains(mousePosition)) {
|
|
8019
8123
|
this.#lookAtFromMinimap(mousePosition);
|
|
8020
8124
|
this.#draggingMinimap = true;
|
|
@@ -8043,6 +8147,9 @@ var NodeFlowGraph = class {
|
|
|
8043
8147
|
addPublisher(identifier, publisher) {
|
|
8044
8148
|
this.#mainNodeSubsystem.addPublisher(identifier, publisher);
|
|
8045
8149
|
}
|
|
8150
|
+
setCasts(casts) {
|
|
8151
|
+
this.#mainNodeSubsystem.setCasts(casts);
|
|
8152
|
+
}
|
|
8046
8153
|
getNodes() {
|
|
8047
8154
|
return this.#mainNodeSubsystem.getNodes();
|
|
8048
8155
|
}
|
|
@@ -8163,6 +8270,9 @@ var NodeFlowGraph = class {
|
|
|
8163
8270
|
addOnNodeRemovedListener(callback) {
|
|
8164
8271
|
this.#mainNodeSubsystem.addOnNodeRemovedListener(callback);
|
|
8165
8272
|
}
|
|
8273
|
+
addNodeHoverListener(callback) {
|
|
8274
|
+
this.#mainNodeSubsystem.addNodeHoverListener(callback);
|
|
8275
|
+
}
|
|
8166
8276
|
#sceenPositionToGraphPosition(screenPosition) {
|
|
8167
8277
|
const out = Zero();
|
|
8168
8278
|
this.#camera.screenSpaceToGraphSpace(screenPosition, out);
|
|
@@ -8188,6 +8298,7 @@ var NodeFlowGraph = class {
|
|
|
8188
8298
|
{
|
|
8189
8299
|
needs: dangling.needs,
|
|
8190
8300
|
types: dangling.types,
|
|
8301
|
+
casts: this.#mainNodeSubsystem.casts(),
|
|
8191
8302
|
onCreated: dangling.connectTo
|
|
8192
8303
|
}
|
|
8193
8304
|
);
|
|
@@ -8259,7 +8370,7 @@ var NodeFlowGraph = class {
|
|
|
8259
8370
|
TimeExecution("Render_Background", this.#renderBackground.bind(this));
|
|
8260
8371
|
TimeExecution("Render_View_" + this.#currentView, () => {
|
|
8261
8372
|
placeEditsDuring(this.#canvas, () => {
|
|
8262
|
-
let results = this.currentView().render(this.#ctx, this.#camera, this.#
|
|
8373
|
+
let results = this.currentView().render(this.#ctx, this.#camera, this.#pointerOnGraph());
|
|
8263
8374
|
if (results?.cursorStyle) {
|
|
8264
8375
|
this.#cursor = results?.cursorStyle;
|
|
8265
8376
|
}
|
|
@@ -8275,6 +8386,19 @@ var NodeFlowGraph = class {
|
|
|
8275
8386
|
}
|
|
8276
8387
|
this.#lastFrameCursor = this.#cursor;
|
|
8277
8388
|
}
|
|
8389
|
+
#pointer() {
|
|
8390
|
+
return this.#mouseOverCanvas ? this.#mousePosition : void 0;
|
|
8391
|
+
}
|
|
8392
|
+
#pointerOnGraph() {
|
|
8393
|
+
const pointer = this.#pointer();
|
|
8394
|
+
if (pointer === void 0) {
|
|
8395
|
+
return void 0;
|
|
8396
|
+
}
|
|
8397
|
+
if (this.#openedContextMenu?.Menu.contains(pointer) || this.#openQuickMenu?.Menu.contains(pointer)) {
|
|
8398
|
+
return void 0;
|
|
8399
|
+
}
|
|
8400
|
+
return pointer;
|
|
8401
|
+
}
|
|
8278
8402
|
#renderBackground() {
|
|
8279
8403
|
this.#backgroundRenderer(this.#canvas, this.#ctx, this.#camera.position, this.#camera.zoom);
|
|
8280
8404
|
}
|
|
@@ -8283,7 +8407,7 @@ var NodeFlowGraph = class {
|
|
|
8283
8407
|
if (this.#openedContextMenu !== null) {
|
|
8284
8408
|
const pos = VectorPool.get();
|
|
8285
8409
|
this.#camera.graphSpaceToScreenSpace(this.#openedContextMenu.Position, pos);
|
|
8286
|
-
this.#contextMenuEntryHovering = this.#openedContextMenu.Menu.render(this.#ctx, pos, this.#camera.zoom, this.#
|
|
8410
|
+
this.#contextMenuEntryHovering = this.#openedContextMenu.Menu.render(this.#ctx, pos, this.#camera.zoom, this.#pointer(), true);
|
|
8287
8411
|
if (this.#contextMenuEntryHovering !== null) {
|
|
8288
8412
|
this.#cursor = "pointer" /* Pointer */;
|
|
8289
8413
|
}
|
|
@@ -8295,7 +8419,7 @@ var NodeFlowGraph = class {
|
|
|
8295
8419
|
if (this.#openQuickMenu !== null) {
|
|
8296
8420
|
const pos = VectorPool.get();
|
|
8297
8421
|
this.#camera.graphSpaceToScreenSpace(this.#openQuickMenu.Position, pos);
|
|
8298
|
-
this.#contextMenuEntryHovering = this.#openQuickMenu.Menu.render(this.#ctx, pos, this.#camera.zoom, this.#
|
|
8422
|
+
this.#contextMenuEntryHovering = this.#openQuickMenu.Menu.render(this.#ctx, pos, this.#camera.zoom, this.#pointer());
|
|
8299
8423
|
if (this.#contextMenuEntryHovering !== null) {
|
|
8300
8424
|
this.#cursor = "pointer" /* Pointer */;
|
|
8301
8425
|
}
|
|
@@ -8343,12 +8467,15 @@ var NodeFlowGraph = class {
|
|
|
8343
8467
|
formatNumber,
|
|
8344
8468
|
onThemeChange,
|
|
8345
8469
|
portConfigTypes,
|
|
8470
|
+
portTypeColor,
|
|
8346
8471
|
portsCompatible,
|
|
8472
|
+
portsConnect,
|
|
8347
8473
|
renderContinuously,
|
|
8348
8474
|
requestRender,
|
|
8349
8475
|
setTheme,
|
|
8350
8476
|
themeVersion,
|
|
8351
8477
|
typeSetsCompatible,
|
|
8478
|
+
typeSetsConnect,
|
|
8352
8479
|
widgetFont
|
|
8353
8480
|
});
|
|
8354
8481
|
//# sourceMappingURL=index.js.map
|