@andespindola/brainlink 0.1.0-beta.146 → 0.1.0-beta.147

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.
@@ -557,7 +557,43 @@ const setViewportFromCanvas = () => {
557
557
  drawFallback()
558
558
  }
559
559
 
560
+ const pickFallbackNodeId = (screenX, screenY) => {
561
+ const nodes = normalizeList(state.chunk.nodes)
562
+ if (nodes.length === 0) {
563
+ return ''
564
+ }
565
+
566
+ let bestId = ''
567
+ let bestDistance = Infinity
568
+ for (let index = 0; index < nodes.length; index += 1) {
569
+ const node = nodes[index]
570
+ const id = typeof node[0] === 'string' ? node[0] : ''
571
+ if (!id) continue
572
+ const x = Number(node[2])
573
+ const y = Number(node[3])
574
+ const weight = Number(node[7])
575
+ if (!Number.isFinite(x) || !Number.isFinite(y)) continue
576
+ const point = worldToScreen(x, y)
577
+ const radius = Math.max(2.4, Math.min(14, 4 + (Number.isFinite(weight) ? weight : 0) * 0.55))
578
+ const distance = Math.hypot(screenX - point.x, screenY - point.y)
579
+ if (distance <= radius && distance < bestDistance) {
580
+ bestDistance = distance
581
+ bestId = id
582
+ }
583
+ }
584
+
585
+ return bestId
586
+ }
587
+
560
588
  const pickAt = (screenX, screenY) => {
589
+ if (state.rendererMode === 'fallback') {
590
+ const nodeId = pickFallbackNodeId(screenX, screenY)
591
+ if (nodeId) {
592
+ loadNodeDetails(nodeId).catch((error) => console.error(error))
593
+ }
594
+ return
595
+ }
596
+
561
597
  if (!state.renderWorker || !state.workerReady) {
562
598
  return
563
599
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andespindola/brainlink",
3
- "version": "0.1.0-beta.146",
3
+ "version": "0.1.0-beta.147",
4
4
  "description": "Local-first knowledge memory for agents with Markdown, backlinks, indexing and context retrieval.",
5
5
  "type": "module",
6
6
  "license": "MIT",