@canvas-harness/core 0.1.12 → 0.1.13

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.cts CHANGED
@@ -2499,10 +2499,14 @@ type Hit = NodeHit | EdgeHit;
2499
2499
  declare const hitTestPoint: (store: CanvasStore, worldPoint: Vec2, cameraZ: number, selectedIds?: ReadonlySet<NodeId>) => NodeHit | null;
2500
2500
  /**
2501
2501
  * Combined node + edge hit testing. Order: node handles > edge endpoint
2502
- * handles > node bodies > edge bodies.
2503
- *
2504
- * Node bodies take priority over edge bodies because clicking ON a node
2505
- * shouldn't accidentally select the edge passing behind it.
2502
+ * handles > visually-topmost body (node or edge, compared by z).
2503
+ *
2504
+ * For bodies, the rule is paint-order: whichever of (node body, edge
2505
+ * body) has the higher z wins, with ties going to edges (edges paint
2506
+ * over nodes by convention). This lets users click an edge that runs
2507
+ * visually over a large background-style node — the 8px polyline slop
2508
+ * keeps the edge's hit zone narrow, so clicks far from the polyline
2509
+ * still land on the node underneath.
2506
2510
  */
2507
2511
  declare const hitTestAny: (store: CanvasStore, worldPoint: Vec2, cameraZ: number, selectedNodes?: ReadonlySet<NodeId>, selectedEdges?: ReadonlySet<EdgeId>) => Hit | null;
2508
2512
  /**
package/dist/index.d.ts CHANGED
@@ -2499,10 +2499,14 @@ type Hit = NodeHit | EdgeHit;
2499
2499
  declare const hitTestPoint: (store: CanvasStore, worldPoint: Vec2, cameraZ: number, selectedIds?: ReadonlySet<NodeId>) => NodeHit | null;
2500
2500
  /**
2501
2501
  * Combined node + edge hit testing. Order: node handles > edge endpoint
2502
- * handles > node bodies > edge bodies.
2503
- *
2504
- * Node bodies take priority over edge bodies because clicking ON a node
2505
- * shouldn't accidentally select the edge passing behind it.
2502
+ * handles > visually-topmost body (node or edge, compared by z).
2503
+ *
2504
+ * For bodies, the rule is paint-order: whichever of (node body, edge
2505
+ * body) has the higher z wins, with ties going to edges (edges paint
2506
+ * over nodes by convention). This lets users click an edge that runs
2507
+ * visually over a large background-style node — the 8px polyline slop
2508
+ * keeps the edge's hit zone narrow, so clicks far from the polyline
2509
+ * still land on the node underneath.
2506
2510
  */
2507
2511
  declare const hitTestAny: (store: CanvasStore, worldPoint: Vec2, cameraZ: number, selectedNodes?: ReadonlySet<NodeId>, selectedEdges?: ReadonlySet<EdgeId>) => Hit | null;
2508
2512
  /**
package/dist/index.js CHANGED
@@ -5851,8 +5851,13 @@ var hitTestAny = (store, worldPoint, cameraZ, selectedNodes = /* @__PURE__ */ ne
5851
5851
  }
5852
5852
  }
5853
5853
  const nodeHit = hitTestPoint(store, worldPoint, cameraZ, selectedNodes);
5854
- if (nodeHit) return nodeHit;
5855
- return hitTestEdge(store, worldPoint, cameraZ);
5854
+ const edgeHit = hitTestEdge(store, worldPoint, cameraZ);
5855
+ if (nodeHit && edgeHit && "edgeId" in edgeHit) {
5856
+ const nodeZ = store.getNode(nodeHit.nodeId)?.z ?? 0;
5857
+ const edgeZ = store.getEdge(edgeHit.edgeId)?.z ?? 0;
5858
+ return edgeZ >= nodeZ ? edgeHit : nodeHit;
5859
+ }
5860
+ return nodeHit ?? edgeHit;
5856
5861
  };
5857
5862
  var marqueeNodes = (store, rect) => {
5858
5863
  const candidates = store.querySpatial({ rect }).nodes;