@andespindola/brainlink 0.1.0-beta.133 → 0.1.0-beta.134
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.
|
@@ -21,6 +21,8 @@ const hierarchyFocusAcquireScale = 0.16
|
|
|
21
21
|
const hierarchyChildRevealPower = 4
|
|
22
22
|
const hierarchyFocusedOnlyProgress = 0.64
|
|
23
23
|
const hierarchyChildGraphFitMargin = 1.28
|
|
24
|
+
const hierarchyChildRevealGrowthRatio = 0.3
|
|
25
|
+
const hierarchyChildRevealGrowthFloor = 2
|
|
24
26
|
const minNodePixelRadius = 2.3
|
|
25
27
|
const viewportPaddingPx = 280
|
|
26
28
|
const worldCoordinateLimit = 5_000_000
|
|
@@ -88,6 +90,8 @@ const state = {
|
|
|
88
90
|
lastZoomFocus: { x: 0, y: 0, at: 0 },
|
|
89
91
|
hierarchyFocusGroupId: null,
|
|
90
92
|
hierarchyFocusStack: [],
|
|
93
|
+
hierarchyRevealFocusGroupId: null,
|
|
94
|
+
hierarchyRevealBudget: 1,
|
|
91
95
|
zoomTransition: {
|
|
92
96
|
active: false,
|
|
93
97
|
source: 'generic',
|
|
@@ -1508,6 +1512,26 @@ const updateHierarchyFocusGroup = (groups, viewport) => {
|
|
|
1508
1512
|
return null
|
|
1509
1513
|
}
|
|
1510
1514
|
|
|
1515
|
+
const updateHierarchyChildRevealBudget = (focusGroupId, targetLimit) => {
|
|
1516
|
+
if (state.hierarchyRevealFocusGroupId !== focusGroupId) {
|
|
1517
|
+
state.hierarchyRevealFocusGroupId = focusGroupId
|
|
1518
|
+
state.hierarchyRevealBudget = 1
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
if (state.hierarchyRevealBudget > targetLimit) {
|
|
1522
|
+
state.hierarchyRevealBudget = targetLimit
|
|
1523
|
+
return targetLimit
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
const remaining = Math.max(0, targetLimit - state.hierarchyRevealBudget)
|
|
1527
|
+
const growth = Math.max(
|
|
1528
|
+
hierarchyChildRevealGrowthFloor,
|
|
1529
|
+
Math.floor(remaining * hierarchyChildRevealGrowthRatio)
|
|
1530
|
+
)
|
|
1531
|
+
state.hierarchyRevealBudget = Math.min(targetLimit, state.hierarchyRevealBudget + growth)
|
|
1532
|
+
return state.hierarchyRevealBudget
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1511
1535
|
const hierarchyViewportProgress = (group, viewport) => {
|
|
1512
1536
|
const coverage = groupViewportCoverage(group, viewport)
|
|
1513
1537
|
const coverageProgress = (coverage - hierarchyFocusAcquireCoverage) / (hierarchyMicroEnterCoverage - hierarchyFocusAcquireCoverage)
|
|
@@ -1582,6 +1606,8 @@ const computeHierarchyRenderVisibility = (viewport) => {
|
|
|
1582
1606
|
if (state.groups.length === 0 || state.visibleNodes.length <= 1000) {
|
|
1583
1607
|
state.hierarchyFocusGroupId = null
|
|
1584
1608
|
state.hierarchyFocusStack = []
|
|
1609
|
+
state.hierarchyRevealFocusGroupId = null
|
|
1610
|
+
state.hierarchyRevealBudget = 1
|
|
1585
1611
|
return false
|
|
1586
1612
|
}
|
|
1587
1613
|
|
|
@@ -1591,6 +1617,8 @@ const computeHierarchyRenderVisibility = (viewport) => {
|
|
|
1591
1617
|
const groupNodes = groups.map(createGroupRenderNode)
|
|
1592
1618
|
|
|
1593
1619
|
if (!focus || progress <= 0.02) {
|
|
1620
|
+
state.hierarchyRevealFocusGroupId = null
|
|
1621
|
+
state.hierarchyRevealBudget = 1
|
|
1594
1622
|
state.renderNodes = groupNodes
|
|
1595
1623
|
state.renderEdges = groupEdgesForRenderedGroups(groupNodes)
|
|
1596
1624
|
return true
|
|
@@ -1602,7 +1630,8 @@ const computeHierarchyRenderVisibility = (viewport) => {
|
|
|
1602
1630
|
.map(groupId => state.groupById.get(groupId))
|
|
1603
1631
|
.filter(Boolean)
|
|
1604
1632
|
const childRevealProgress = Math.pow(Math.max(0, Math.min(1, progress)), hierarchyChildRevealPower)
|
|
1605
|
-
const
|
|
1633
|
+
const childTargetLimit = Math.min(renderNodeBudget, Math.max(1, Math.floor(renderNodeBudget * childRevealProgress)))
|
|
1634
|
+
const childLimit = updateHierarchyChildRevealBudget(focus.id, childTargetLimit)
|
|
1606
1635
|
const focusRenderNode = groupNodes.find(node => node.groupId === focus.id) ?? createGroupRenderNode(focus)
|
|
1607
1636
|
const arrangedChildren = focusChildGroups.length > 0
|
|
1608
1637
|
? arrangeChildGroupNodes(focusChildGroups, focus, focusRenderNode)
|
|
@@ -2102,6 +2131,8 @@ const resetView = () => fitView({ useFiltered: false, preferHubCenter: false })
|
|
|
2102
2131
|
const resetHierarchyFocus = () => {
|
|
2103
2132
|
state.hierarchyFocusGroupId = null
|
|
2104
2133
|
state.hierarchyFocusStack = []
|
|
2134
|
+
state.hierarchyRevealFocusGroupId = null
|
|
2135
|
+
state.hierarchyRevealBudget = 1
|
|
2105
2136
|
}
|
|
2106
2137
|
|
|
2107
2138
|
const focusPrimaryHub = () => {
|
|
@@ -3312,6 +3343,8 @@ const loadGraph = async (options = { reset: false }) => {
|
|
|
3312
3343
|
state.groups = layout.groups
|
|
3313
3344
|
state.hierarchyFocusGroupId = null
|
|
3314
3345
|
state.hierarchyFocusStack = []
|
|
3346
|
+
state.hierarchyRevealFocusGroupId = null
|
|
3347
|
+
state.hierarchyRevealBudget = 1
|
|
3315
3348
|
state.groupById = new Map(state.groups.map(group => [group.id, group]))
|
|
3316
3349
|
state.leafGroups = state.groups.filter(group => group.nodeIds.length > 0)
|
|
3317
3350
|
state.nodeLeafGroupById = new Map(state.leafGroups.flatMap(group => group.nodeIds.map(nodeId => [nodeId, group])))
|
package/package.json
CHANGED