Skip to content

Commit

Permalink
Add support for focusing a node in SceneGraph Inspector (#563)
Browse files Browse the repository at this point in the history
Co-authored-by: Brian Leighty <[email protected]>
  • Loading branch information
triwav and triwav authored Apr 17, 2024
1 parent f3270ef commit 551b821
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 5 additions & 1 deletion webviews/src/ExtensionIntermediary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { RequestType } from 'roku-test-automation/client/dist/types/OnDeviceComp
import type { VscodeCommand } from '../../src/commands/VscodeCommand';
import type { ViewProviderEvent } from '../../src/viewProviders/ViewProviderEvent';
import { ViewProviderCommand } from '../../src/viewProviders/ViewProviderCommand';
import type { DeleteEntireRegistrySectionsArgs, DeleteNodeReferencesArgs, DeleteRegistrySectionsArgs, FindNodesAtLocationArgs, GetFocusedNodeArgs, GetNodesInfoArgs, GetNodesWithPropertiesArgs, GetValueArgs, GetValuesArgs, HasFocusArgs, IsInFocusChainArgs, OnFieldChangeOnceArgs, ReadRegistryArgs, RequestOptions, SetValueArgs, StoreNodeReferencesArgs, WriteRegistryArgs, GetVolumeListArgs, GetDirectoryListingArgs, StatPathArgs, RenameFileArgs, DeleteFileArgs, CreateDirectoryArgs, RemoveNodeChildrenArgs } from 'roku-test-automation';
import type { DeleteEntireRegistrySectionsArgs, DeleteNodeReferencesArgs, DeleteRegistrySectionsArgs, FindNodesAtLocationArgs, GetFocusedNodeArgs, GetNodesInfoArgs, GetNodesWithPropertiesArgs, GetValueArgs, GetValuesArgs, HasFocusArgs, IsInFocusChainArgs, OnFieldChangeOnceArgs, ReadRegistryArgs, RequestOptions, SetValueArgs, StoreNodeReferencesArgs, WriteRegistryArgs, GetVolumeListArgs, GetDirectoryListingArgs, StatPathArgs, RenameFileArgs, DeleteFileArgs, CreateDirectoryArgs, RemoveNodeChildrenArgs, FocusNodeArgs } from 'roku-test-automation';

class ExtensionIntermediary {
private inflightRequests = {};
Expand Down Expand Up @@ -248,6 +248,10 @@ class ODCIntermediary {
public async removeNodeChildren(args: RemoveNodeChildrenArgs, options?: RequestOptions) {
return this.sendOdcMessage<ReturnType<typeof rta.odc.removeNodeChildren>>(RequestType.removeNodeChildren, args, options);
}

public async focusNode(args: FocusNodeArgs, options?: RequestOptions) {
return this.sendOdcMessage<ReturnType<typeof rta.odc.focusNode>>(RequestType.focusNode, args, options);
}
}

type ObserverCallback = (message) => void;
Expand Down
14 changes: 13 additions & 1 deletion webviews/src/views/SceneGraphInspectorView/Branch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import throttle from 'just-throttle';
import { odc } from '../../ExtensionIntermediary';
import { utils } from '../../utils';
import { Eye, EyeClosed, DebugBreakpointDataUnverified, Move } from 'svelte-codicons';
import { Eye, EyeClosed, DebugBreakpointDataUnverified, Move, Issues } from 'svelte-codicons';
import Chevron from '../../shared/Chevron.svelte';
import type { TreeNodeWithBase } from '../../shared/types';
import { createEventDispatcher } from 'svelte';
Expand Down Expand Up @@ -171,6 +171,12 @@
expanded = true;
dispatch('childExpanded');
}
async function focusNode() {
await odc.focusNode({
keyPath: treeNode.keyPath
});
}
</script>

<style>
Expand Down Expand Up @@ -265,6 +271,12 @@
</span>
</div>
<div class="actions">
{#if treeNode.visible !== undefined}
<span title="Focus Node" class="icon-button" on:click|stopPropagation={focusNode}>
<Issues />
</span>
{/if}

{#if treeNode.translation !== undefined}
<span
title="Move Node Position"
Expand Down

0 comments on commit 551b821

Please sign in to comment.