Skip to content

Commit

Permalink
final cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Leighty committed Mar 21, 2024
1 parent b60cfb5 commit 61ad17d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
3 changes: 2 additions & 1 deletion webviews/src/views/RokuDeviceView/RokuDeviceView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
enableScreenshotCapture = false;
if (isInspectingNodes) {
lastStoreNodesResponse = odc.storeNodeReferences({
lastStoreNodesResponse = await odc.storeNodeReferences({
includeNodeCountInfo: true,
includeArrayGridChildren: true,
includeBoundingRectInfo: true
Expand Down Expand Up @@ -388,6 +388,7 @@
<b>height:</b> {focusedTreeNode.sceneRect.height}
</div>
{/if}
<!-- only show image if we have a url to avoid showing as broken image -->
{#if screenshotUrl}
<img
id="screenshot"
Expand Down
35 changes: 29 additions & 6 deletions webviews/src/views/SceneGraphInspectorView/Branch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,35 @@
export let expandTreeNode: TreeNodeWithBase | undefined;
$: {
// Don't want to run on empty keypaths as these are at the base level and should stay expanded
if (treeNode.keyPath) {
// Want to collapse for everything but Scene which has an empty key path
// We we want the only variable in the reactive statement to be expandTreeNode or else it will also trigger when expanded changes as well
expandTreeNodeChecks(expandTreeNode);
}
function expandTreeNodeChecks(expandTreeNode) {
if (!expandTreeNode) {
// Don't want to run on empty keypaths as these are at the base level and should stay expanded
if (treeNode.keyPath) {
expanded = false
}
} else {
expanded = doTreeNodesMatch(treeNode, expandTreeNode);
if (expanded) {
// We need to expand all the parents before we can calculate how far we need to scroll down
dispatch('childExpanded');
const scrollToElement = (element) => {
const offset = getOffset(element);
document.getElementById('container').scrollTo({
left: 0,
top: offset.top - 90,
behavior: 'auto'
});
}
setTimeout(() => {
scrollToElement(self);
}, 0);
}
}
}
Expand All @@ -43,9 +68,7 @@
function doTreeNodesMatch(treeNodeA: TreeNodeWithBase, treeNodeB: TreeNodeWithBase | undefined) {
if (treeNodeB) {
if (treeNodeA.subtype === 'MainNode') {
}
if (treeNodeA.parentRef >= 0 && treeNodeB.parentRef >= 0) {
if (treeNodeA.parentRef >= 0 && (treeNodeB.parentRef >= 0 || treeNodeB.parentRef === undefined)) {
// Use key path to compare if we have a parentRef
if (treeNodeA.keyPath === treeNodeB.keyPath && treeNodeB.base === treeNodeB.base) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@
}
intermediary.observeEvent(ViewProviderEvent.onTreeNodeFocused, (message) => {
console.log('received onTreeNodeFocused', message.context.treeNode);
const context = message.context;
selectTreeNode = context.treeNode;
expandTreeNode = context.treeNode;
Expand Down

0 comments on commit 61ad17d

Please sign in to comment.