Skip to content

Commit

Permalink
Fix rdb keypaths and focus scrolling (#455)
Browse files Browse the repository at this point in the history
* Fix focus scrolling to work properly the first time even if all levels were collapsed

* update to RTA v2.0 beta 11

* Update absolute key path to properly be able to dig into ArrayGrids and use `#` before findNode keys

* expand focused node for easier access to its children

Co-authored-by: Brian Leighty <[email protected]>
Co-authored-by: Bronley Plumb <[email protected]>
  • Loading branch information
3 people authored Jan 9, 2023
1 parent 0270516 commit 0ed210a
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 20 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"pretty-bytes": "^5.6.0",
"roku-debug": "^0.17.3",
"roku-deploy": "^3.9.2",
"roku-test-automation": "^2.0.0-beta.9",
"roku-test-automation": "^2.0.0-beta.11",
"semver": "^7.1.3",
"source-map": "^0.7.3",
"thenby": "^1.3.4",
Expand Down
2 changes: 1 addition & 1 deletion src/viewProviders/BaseRdbViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export abstract class BaseRdbViewProvider extends BaseWebviewViewProvider {
'getNodesInfo',
'hasFocus',
'isInFocusChain',
'observeField',
'onFieldChangeOnce',
'readRegistry',
'setValue',
'writeRegistry',
Expand Down
25 changes: 16 additions & 9 deletions webviews/src/views/SceneGraphInspectorView/NodeBranchPage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,25 @@
let selected = false;
export let focusedNode = -1;
$: {
// If we are the focused node then we want to scroll down to this node
if (focusedNode !== -1 && nodeTree.ref === focusedNode) {
// We need to expand all the parents before we can calculate how far we need to scroll down
dispatch('childExpanded');
selected = true;
if (self) {
const rect = self.getBoundingClientRect()
document.getElementById('container').scrollTo({
left: rect.left,
top: rect.top - 90,
behavior: 'smooth'
});
}
dispatch('childExpanded');
// Go ahead and expand us as well to speed up digging into children if desired
expanded = true
setTimeout(() => {
if (self) {
const rect = self.getBoundingClientRect()
document.getElementById('container').scrollTo({
left: rect.left,
top: rect.top - 90,
behavior: 'smooth'
});
}
}, 0);
} else {
selected = false;
}
Expand Down
20 changes: 18 additions & 2 deletions webviews/src/views/SceneGraphInspectorView/NodeDetailPage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,24 @@
let nodeTree = inspectNodeNodeTree;
if (inspectNodeNodeTree) {
while (nodeTree) {
if (nodeTree.id) {
absoluteKeyPathParts.unshift(nodeTree.id);
if (nodeTree.subtype === 'RowListItem') {
// If we encounter a RowListItem then we know we need to modify the keypath structure
const position = absoluteKeyPathParts.shift();
for (const child of nodeTree.children) {
if (child.position === position) {
if (child.subtype === 'MarkupGrid') {
absoluteKeyPathParts.unshift('items');
} else if (child.subtype === 'Group') {
absoluteKeyPathParts.unshift('title');
} else {
console.log('Encountered unexpected subtype ' + child.subtype);
}
break;
}
}
absoluteKeyPathParts.unshift(nodeTree.position);
} else if (nodeTree.id) {
absoluteKeyPathParts.unshift('#' + nodeTree.id);
} else if (nodeTree.position >= 0) {
absoluteKeyPathParts.unshift(nodeTree.position);
}
Expand Down

0 comments on commit 0ed210a

Please sign in to comment.