@andespindola/brainlink 0.1.0-beta.57 → 0.1.0-beta.58
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.
|
@@ -710,9 +710,9 @@ const ensureHubNodesInRenderedSet = (nodes) => {
|
|
|
710
710
|
}
|
|
711
711
|
|
|
712
712
|
const zoomCapByNodeCount = (nodeCount) => {
|
|
713
|
-
if (nodeCount > 50000) return
|
|
714
|
-
if (nodeCount > 20000) return
|
|
715
|
-
if (nodeCount > 6000) return 1
|
|
713
|
+
if (nodeCount > 50000) return 2.6
|
|
714
|
+
if (nodeCount > 20000) return 2.35
|
|
715
|
+
if (nodeCount > 6000) return 2.1
|
|
716
716
|
if (nodeCount > 2000) return 2.2
|
|
717
717
|
return zoomRange.max
|
|
718
718
|
}
|
|
@@ -731,7 +731,9 @@ const zoomCapByHubDistance = (distance) => {
|
|
|
731
731
|
|
|
732
732
|
const currentZoomMax = () => {
|
|
733
733
|
const nodeCount = state.visibleNodes.length > 0 ? state.visibleNodes.length : state.nodes.length
|
|
734
|
-
const
|
|
734
|
+
const hubDistanceCap = zoomCapByHubDistance(state.hubNeighborDistance)
|
|
735
|
+
const minimumUsefulCap = nodeCount > massiveGraphNodeThreshold ? 1.9 : nodeCount > largeGraphNodeThreshold ? 1.35 : 0.8
|
|
736
|
+
const capped = Math.min(zoomCapByNodeCount(nodeCount), Math.max(minimumUsefulCap, hubDistanceCap))
|
|
735
737
|
return Math.max(zoomRange.min * 2, capped)
|
|
736
738
|
}
|
|
737
739
|
|
|
@@ -1066,7 +1068,12 @@ const hitNode = point => {
|
|
|
1066
1068
|
if (state.renderClusters.length > 0) {
|
|
1067
1069
|
return null
|
|
1068
1070
|
}
|
|
1069
|
-
|
|
1071
|
+
const hitScaleFloor = state.nodes.length > massiveGraphNodeThreshold
|
|
1072
|
+
? 0.2
|
|
1073
|
+
: state.nodes.length > largeGraphNodeThreshold
|
|
1074
|
+
? 0.34
|
|
1075
|
+
: 0
|
|
1076
|
+
if (state.transform.scale < hitScaleFloor) {
|
|
1070
1077
|
return null
|
|
1071
1078
|
}
|
|
1072
1079
|
|
|
@@ -1478,6 +1485,7 @@ const render = now => {
|
|
|
1478
1485
|
const shouldDrawLabels =
|
|
1479
1486
|
isSelected ||
|
|
1480
1487
|
isHovered ||
|
|
1488
|
+
(state.nodes.length > largeGraphNodeThreshold && state.transform.scale >= 0.62 && state.renderNodes.length <= 1200) ||
|
|
1481
1489
|
(state.nodes.length <= largeGraphNodeThreshold && (state.transform.scale > 1.18 || state.nodes.length <= 25))
|
|
1482
1490
|
if (shouldDrawLabels) {
|
|
1483
1491
|
ctx.fillStyle = graphTheme.label
|
|
@@ -1721,7 +1729,7 @@ const bindEvents = () => {
|
|
|
1721
1729
|
const point = worldPoint(event)
|
|
1722
1730
|
const now = performance.now()
|
|
1723
1731
|
const canHoverHitTest =
|
|
1724
|
-
!(state.nodes.length > massiveGraphNodeThreshold && state.transform.scale < 0.
|
|
1732
|
+
!(state.nodes.length > massiveGraphNodeThreshold && state.transform.scale < 0.06)
|
|
1725
1733
|
const shouldHitTest = canHoverHitTest &&
|
|
1726
1734
|
(state.pointer.down || now - state.lastHoverHitAt >= hoverHitTestIntervalMs)
|
|
1727
1735
|
if (shouldHitTest) {
|
package/package.json
CHANGED