@andespindola/brainlink 0.1.0-beta.18 → 0.1.0-beta.19

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.
@@ -155,6 +155,17 @@ const graphBounds = nodes => {
155
155
  }
156
156
  }
157
157
 
158
+ const fitScaleBiasByNodeCount = nodeCount => {
159
+ if (nodeCount <= 6) return 2.4
160
+ if (nodeCount <= 20) return 1.9
161
+ if (nodeCount <= 60) return 1.5
162
+ if (nodeCount <= 180) return 1.25
163
+ if (nodeCount <= 600) return 1.05
164
+ if (nodeCount <= 2000) return 0.9
165
+ if (nodeCount <= 6000) return 0.72
166
+ return 0.62
167
+ }
168
+
158
169
  const fitView = (options = { useFiltered: true }) => {
159
170
  const rect = canvas.getBoundingClientRect()
160
171
  const width = Math.max(rect.width, 320)
@@ -171,8 +182,9 @@ const fitView = (options = { useFiltered: true }) => {
171
182
  const scaleX = width / (bounds.width + padding * 2)
172
183
  const scaleY = height / (bounds.height + padding * 2)
173
184
  const fitScale = clampScale(Math.min(scaleX, scaleY))
185
+ const biasedScale = clampScale(fitScale * fitScaleBiasByNodeCount(nodes.length))
174
186
  const minimumLargeGraphScale = nodes.length > largeGraphNodeThreshold ? 0.13 : zoomRange.min
175
- const scale = Math.max(fitScale, minimumLargeGraphScale)
187
+ const scale = Math.max(biasedScale, minimumLargeGraphScale)
176
188
  const centerX = (bounds.minX + bounds.maxX) / 2
177
189
  const centerY = (bounds.minY + bounds.maxY) / 2
178
190
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andespindola/brainlink",
3
- "version": "0.1.0-beta.18",
3
+ "version": "0.1.0-beta.19",
4
4
  "description": "Local-first knowledge memory for agents with Markdown, backlinks, indexing and context retrieval.",
5
5
  "type": "module",
6
6
  "license": "MIT",