@canvas-harness/core 0.1.16 → 0.1.17
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.cjs +21 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +21 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3458,14 +3458,18 @@ var fromSerialized = (raw) => {
|
|
|
3458
3458
|
...ser.frameOrder ? { frameOrder: ser.frameOrder } : {}
|
|
3459
3459
|
};
|
|
3460
3460
|
};
|
|
3461
|
-
var storeToJSON = (store) =>
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3461
|
+
var storeToJSON = (store) => {
|
|
3462
|
+
const frameOrder = store.getFrames().map((f) => f.id);
|
|
3463
|
+
return {
|
|
3464
|
+
schemaVersion: SCHEMA_VERSION,
|
|
3465
|
+
nodes: store.getAllNodes(),
|
|
3466
|
+
edges: store.getAllEdges(),
|
|
3467
|
+
groups: store.getAllGroups(),
|
|
3468
|
+
camera: store.getCamera(),
|
|
3469
|
+
selection: store.getSelection(),
|
|
3470
|
+
...frameOrder.length > 0 ? { frameOrder } : {}
|
|
3471
|
+
};
|
|
3472
|
+
};
|
|
3469
3473
|
|
|
3470
3474
|
// src/render/canvas-setup.ts
|
|
3471
3475
|
var HARD_MAX_DPR = 3;
|
|
@@ -4427,8 +4431,8 @@ var darkenedStyle = (style) => {
|
|
|
4427
4431
|
const stroke = style.strokeColor;
|
|
4428
4432
|
const next = {
|
|
4429
4433
|
...style,
|
|
4430
|
-
...fill ? { backgroundColor: darkenHex(fill) } : {},
|
|
4431
|
-
...stroke ? { strokeColor: darkenHex(stroke) } : {}
|
|
4434
|
+
...fill && !isFullyTransparent(fill) ? { backgroundColor: darkenHex(fill) } : {},
|
|
4435
|
+
...stroke && !isFullyTransparent(stroke) ? { strokeColor: darkenHex(stroke) } : {}
|
|
4432
4436
|
};
|
|
4433
4437
|
darkenedStyleCache.set(style, next);
|
|
4434
4438
|
return next;
|
|
@@ -5887,14 +5891,15 @@ var serializeSelection = (store) => {
|
|
|
5887
5891
|
const n = store.getNode(id);
|
|
5888
5892
|
if (n) nodes.push(n);
|
|
5889
5893
|
}
|
|
5890
|
-
const
|
|
5894
|
+
const selectedEdgeIds = /* @__PURE__ */ new Set();
|
|
5891
5895
|
for (const id of selectedIds) {
|
|
5892
|
-
|
|
5893
|
-
if (e && bothEndsInsideSelection(e, selectedNodeIds)) edges.push(e);
|
|
5896
|
+
if (store.getEdge(id)) selectedEdgeIds.add(id);
|
|
5894
5897
|
}
|
|
5898
|
+
const edges = [];
|
|
5895
5899
|
for (const e of store.getAllEdges()) {
|
|
5896
|
-
if (
|
|
5897
|
-
if (
|
|
5900
|
+
if (!bothEndsInsideSelection(e, selectedNodeIds)) continue;
|
|
5901
|
+
if (hasFreeFloatingEnd(e) && !selectedEdgeIds.has(e.id)) continue;
|
|
5902
|
+
edges.push(e);
|
|
5898
5903
|
}
|
|
5899
5904
|
return {
|
|
5900
5905
|
v: SCHEMA_VERSION,
|
|
@@ -5911,6 +5916,7 @@ var endInside = (end, ids) => {
|
|
|
5911
5916
|
if (!isAttached(end)) return true;
|
|
5912
5917
|
return ids.has(end.nodeId);
|
|
5913
5918
|
};
|
|
5919
|
+
var hasFreeFloatingEnd = (edge) => !isAttached(edge.source) || !isAttached(edge.target);
|
|
5914
5920
|
var clipBboxCenter = (nodes) => {
|
|
5915
5921
|
if (nodes.length === 0) return { x: 0, y: 0 };
|
|
5916
5922
|
let minX = Number.POSITIVE_INFINITY;
|