@html-graph/html-graph 9.0.0 → 9.1.0
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/html-graph.d.ts +20 -14
- package/dist/html-graph.js +26 -14
- package/dist/html-graph.min.js +499 -494
- package/dist/html-graph.min.umd.cjs +1 -1
- package/dist/html-graph.umd.cjs +26 -14
- package/package.json +1 -1
package/dist/html-graph.umd.cjs
CHANGED
|
@@ -1101,10 +1101,10 @@
|
|
|
1101
1101
|
};
|
|
1102
1102
|
//#endregion
|
|
1103
1103
|
//#region src/configurators/shared/find-port-at-point/find-port-for-element/find-port-for-element.ts
|
|
1104
|
-
var findPortForElement = (graph, element) => {
|
|
1104
|
+
var findPortForElement = (graph, element, portIdResolver) => {
|
|
1105
1105
|
let elementBuf = element;
|
|
1106
1106
|
while (elementBuf !== null) {
|
|
1107
|
-
const portId = graph.findPortIdsByElement(elementBuf)
|
|
1107
|
+
const portId = portIdResolver(graph.findPortIdsByElement(elementBuf));
|
|
1108
1108
|
if (portId !== null) return {
|
|
1109
1109
|
status: "portFound",
|
|
1110
1110
|
portId
|
|
@@ -1128,10 +1128,10 @@
|
|
|
1128
1128
|
}
|
|
1129
1129
|
//#endregion
|
|
1130
1130
|
//#region src/configurators/shared/find-port-at-point/find-port-at-point.ts
|
|
1131
|
-
var findPortAtPoint = (graph, point) => {
|
|
1131
|
+
var findPortAtPoint = (graph, point, portIdResolver) => {
|
|
1132
1132
|
const elements = getElementsAtPoint(document, point);
|
|
1133
1133
|
for (const element of elements) {
|
|
1134
|
-
const result = findPortForElement(graph, element);
|
|
1134
|
+
const result = findPortForElement(graph, element, portIdResolver);
|
|
1135
1135
|
if (result.status === "portFound") return result.portId;
|
|
1136
1136
|
if (result.status === "nodeEncountered") return null;
|
|
1137
1137
|
}
|
|
@@ -3337,7 +3337,9 @@
|
|
|
3337
3337
|
const mouseEvent = event;
|
|
3338
3338
|
if (!this.params.mouseDownEventVerifier(mouseEvent)) return;
|
|
3339
3339
|
const target = event.currentTarget;
|
|
3340
|
-
const
|
|
3340
|
+
const portIds = this.canvas.graph.findPortIdsByElement(target);
|
|
3341
|
+
const portId = this.params.grabbedPortIdResolver(portIds);
|
|
3342
|
+
if (portId === null) return;
|
|
3341
3343
|
if (!this.params.onPointerDownVerifier(portId, {
|
|
3342
3344
|
x: mouseEvent.clientX,
|
|
3343
3345
|
y: mouseEvent.clientY
|
|
@@ -3638,6 +3640,12 @@
|
|
|
3638
3640
|
}
|
|
3639
3641
|
};
|
|
3640
3642
|
//#endregion
|
|
3643
|
+
//#region src/configurators/shared/port-id-resolver/default-port-id-resolver/default-port-id-resolver.ts
|
|
3644
|
+
var defaultPortIdResolver = (portIds) => {
|
|
3645
|
+
if (portIds.length > 0) return portIds[0];
|
|
3646
|
+
return null;
|
|
3647
|
+
};
|
|
3648
|
+
//#endregion
|
|
3641
3649
|
//#region src/configurators/user-draggable-nodes-configurator/user-draggable-nodes-configurator.ts
|
|
3642
3650
|
var UserDraggableNodesConfigurator = class UserDraggableNodesConfigurator {
|
|
3643
3651
|
canvas;
|
|
@@ -4303,7 +4311,8 @@
|
|
|
4303
4311
|
const params = this.edgeInProgress;
|
|
4304
4312
|
this.resetDragState();
|
|
4305
4313
|
this.params.onEdgeCreationInterrupted(params);
|
|
4306
|
-
}
|
|
4314
|
+
},
|
|
4315
|
+
grabbedPortIdResolver: this.params.grabbedPortIdResolver
|
|
4307
4316
|
};
|
|
4308
4317
|
DraggablePortsConfigurator.configure(this.canvas, this.window, this.pointInsideVerifier, this.eventTagger, draggablePortsParams);
|
|
4309
4318
|
}
|
|
@@ -4357,7 +4366,7 @@
|
|
|
4357
4366
|
this.overlayCanvas.clear();
|
|
4358
4367
|
}
|
|
4359
4368
|
tryCreateConnection(cursor) {
|
|
4360
|
-
const targetPortId = findPortAtPoint(this.canvas.graph, cursor);
|
|
4369
|
+
const targetPortId = findPortAtPoint(this.canvas.graph, cursor, this.params.releasedPortIdResolver);
|
|
4361
4370
|
if (targetPortId === null) {
|
|
4362
4371
|
this.params.onEdgeCreationInterrupted(this.edgeInProgress);
|
|
4363
4372
|
return;
|
|
@@ -4438,7 +4447,8 @@
|
|
|
4438
4447
|
shape: edge.shape,
|
|
4439
4448
|
priority: edge.priority
|
|
4440
4449
|
});
|
|
4441
|
-
}
|
|
4450
|
+
},
|
|
4451
|
+
grabbedPortIdResolver: this.params.grabbedPortIdResolver
|
|
4442
4452
|
};
|
|
4443
4453
|
DraggablePortsConfigurator.configure(this.canvas, this.window, this.pointInsideVerifier, this.eventTagger, draggablePortsParams);
|
|
4444
4454
|
}
|
|
@@ -4528,7 +4538,7 @@
|
|
|
4528
4538
|
}).updatePort(OverlayId.DraggingNodeId, { direction });
|
|
4529
4539
|
}
|
|
4530
4540
|
tryCreateConnection(cursor) {
|
|
4531
|
-
const draggingPortId = findPortAtPoint(this.canvas.graph, cursor);
|
|
4541
|
+
const draggingPortId = findPortAtPoint(this.canvas.graph, cursor, this.params.releasedPortIdResolver);
|
|
4532
4542
|
this.overlayCanvas.removeEdge(OverlayId.EdgeId);
|
|
4533
4543
|
if (draggingPortId === null) {
|
|
4534
4544
|
const edge = this.draggingEdgePayload;
|
|
@@ -4715,19 +4725,17 @@
|
|
|
4715
4725
|
//#endregion
|
|
4716
4726
|
//#region src/configurators/animated-layout-configurator/animated-layout-configurator.ts
|
|
4717
4727
|
var AnimatedLayoutConfigurator = class AnimatedLayoutConfigurator {
|
|
4718
|
-
win;
|
|
4719
4728
|
applier;
|
|
4720
4729
|
step = (dt) => {
|
|
4721
4730
|
this.applier.apply(dt);
|
|
4722
4731
|
};
|
|
4723
4732
|
constructor(canvas, params, win) {
|
|
4724
|
-
this.win = win;
|
|
4725
4733
|
this.applier = new AnimatedLayoutApplier(canvas, params.algorithm, {
|
|
4726
4734
|
staticNodeResolver: params.staticNodeResolver,
|
|
4727
4735
|
onBeforeApplied: params.onBeforeApplied,
|
|
4728
4736
|
onAfterApplied: params.onAfterApplied
|
|
4729
4737
|
});
|
|
4730
|
-
new AnimationSeries(
|
|
4738
|
+
new AnimationSeries(win, this.step);
|
|
4731
4739
|
}
|
|
4732
4740
|
static configure(canvas, params, win) {
|
|
4733
4741
|
new AnimatedLayoutConfigurator(canvas, params, win);
|
|
@@ -5196,7 +5204,9 @@
|
|
|
5196
5204
|
mouseUpEventVerifier: config.mouseUpEventVerifier ?? defaults$3.mouseEventVerifier,
|
|
5197
5205
|
onAfterEdgeCreated: config.events?.onAfterEdgeCreated ?? noopFn,
|
|
5198
5206
|
onEdgeCreationInterrupted: config.events?.onEdgeCreationInterrupted ?? noopFn,
|
|
5199
|
-
onEdgeCreationPrevented: config.events?.onEdgeCreationPrevented ?? noopFn
|
|
5207
|
+
onEdgeCreationPrevented: config.events?.onEdgeCreationPrevented ?? noopFn,
|
|
5208
|
+
grabbedPortIdResolver: config.grabbedPortIdResolver ?? defaultPortIdResolver,
|
|
5209
|
+
releasedPortIdResolver: config.releasedPortIdResolver ?? defaultPortIdResolver
|
|
5200
5210
|
};
|
|
5201
5211
|
};
|
|
5202
5212
|
//#endregion
|
|
@@ -5226,7 +5236,9 @@
|
|
|
5226
5236
|
onAfterEdgeReattached: config.events?.onAfterEdgeReattached ?? noopFn,
|
|
5227
5237
|
onEdgeReattachInterrupted: config.events?.onEdgeReattachInterrupted ?? noopFn,
|
|
5228
5238
|
onEdgeReattachPrevented: config.events?.onEdgeReattachPrevented ?? noopFn,
|
|
5229
|
-
draggingPortDirectionResolver: resolveDraggingPortDirectionResolver(config.dragPortDirection, graph, connectionAllowedVerifier)
|
|
5239
|
+
draggingPortDirectionResolver: resolveDraggingPortDirectionResolver(config.dragPortDirection, graph, connectionAllowedVerifier),
|
|
5240
|
+
grabbedPortIdResolver: config.grabbedPortIdResolver ?? defaultPortIdResolver,
|
|
5241
|
+
releasedPortIdResolver: config.releasedPortIdResolver ?? defaultPortIdResolver
|
|
5230
5242
|
};
|
|
5231
5243
|
};
|
|
5232
5244
|
//#endregion
|