@andespindola/brainlink 0.1.0-beta.67 → 0.1.0-beta.68
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.
|
@@ -684,6 +684,38 @@ const mergeUniqueNodes = (leftNodes, rightNodes, limit) => {
|
|
|
684
684
|
return merged
|
|
685
685
|
}
|
|
686
686
|
|
|
687
|
+
const selectStableSampleNodes = (sourceNodes, limit) => {
|
|
688
|
+
if (sourceNodes.length <= limit) {
|
|
689
|
+
return sourceNodes
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
const now = performance.now()
|
|
693
|
+
const recentZoomFocus =
|
|
694
|
+
now - state.lastZoomFocus.at <= 1500
|
|
695
|
+
? { x: state.lastZoomFocus.x, y: state.lastZoomFocus.y }
|
|
696
|
+
: null
|
|
697
|
+
const anchor = recentZoomFocus ?? viewportCenterWorldPoint()
|
|
698
|
+
const previousIds = new Set(state.renderNodes.map((node) => node.id))
|
|
699
|
+
|
|
700
|
+
return [...sourceNodes]
|
|
701
|
+
.sort((left, right) => {
|
|
702
|
+
const leftWasVisible = previousIds.has(left.id) ? 1 : 0
|
|
703
|
+
const rightWasVisible = previousIds.has(right.id) ? 1 : 0
|
|
704
|
+
if (leftWasVisible !== rightWasVisible) return rightWasVisible - leftWasVisible
|
|
705
|
+
|
|
706
|
+
const leftDistance = Math.hypot(left.x - anchor.x, left.y - anchor.y)
|
|
707
|
+
const rightDistance = Math.hypot(right.x - anchor.x, right.y - anchor.y)
|
|
708
|
+
if (leftDistance !== rightDistance) return leftDistance - rightDistance
|
|
709
|
+
|
|
710
|
+
const leftDegree = state.nodeDegrees.get(left.id) ?? 0
|
|
711
|
+
const rightDegree = state.nodeDegrees.get(right.id) ?? 0
|
|
712
|
+
if (leftDegree !== rightDegree) return rightDegree - leftDegree
|
|
713
|
+
|
|
714
|
+
return left.id.localeCompare(right.id)
|
|
715
|
+
})
|
|
716
|
+
.slice(0, limit)
|
|
717
|
+
}
|
|
718
|
+
|
|
687
719
|
const selectAccessBridgeNodes = (sourceNodes, limit) => {
|
|
688
720
|
if (limit <= 0 || sourceNodes.length === 0) {
|
|
689
721
|
return []
|
|
@@ -1741,9 +1773,10 @@ const computeRenderVisibility = () => {
|
|
|
1741
1773
|
selectAccessBridgeNodes(sourceNodes, bridgeLimit),
|
|
1742
1774
|
Math.min(renderNodeBudget, sampleLimit + bridgeLimit)
|
|
1743
1775
|
)
|
|
1744
|
-
const sampled =
|
|
1745
|
-
|
|
1746
|
-
|
|
1776
|
+
const sampled = selectStableSampleNodes(
|
|
1777
|
+
bridgedNodes,
|
|
1778
|
+
Math.min(sampleLimit, renderNodeBudget)
|
|
1779
|
+
)
|
|
1747
1780
|
const sampledIds = new Set(sampled.map((node) => node.id))
|
|
1748
1781
|
let sampledEdges = state.transform.scale >= 0.035 ? collectVisibleEdgesForNodes(sampledIds) : []
|
|
1749
1782
|
let sampledNodes = ensureHubNodesInRenderedSet(sampled)
|
|
@@ -2134,7 +2167,7 @@ const wheelZoomFactor = event => {
|
|
|
2134
2167
|
return 1
|
|
2135
2168
|
}
|
|
2136
2169
|
|
|
2137
|
-
const baseStep = Math.max(0.
|
|
2170
|
+
const baseStep = Math.max(0.012, Math.min(0.11, absoluteDelta / 980))
|
|
2138
2171
|
const adjustedStep = baseStep * (isModifierZoom ? 1.24 : 1)
|
|
2139
2172
|
|
|
2140
2173
|
return event.deltaY < 0 ? 1 + adjustedStep : 1 / (1 + adjustedStep)
|
package/package.json
CHANGED