Skip to content

Commit 78487f4

Browse files
authored
[fgviewer] Collapse subresources by default in web view (#8517)
* Collapse subresources by default * Fix typo
1 parent 25e9802 commit 78487f4

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

libs/fgviewer/web/app.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ class FrameGraphTable extends LitElement {
346346
super();
347347
this.frameGraphData = null;
348348
this.selectedResourceId = -1;
349-
this.collapsedResources = new Set();
349+
this.expandedResourceSet = new Set();
350350
}
351351

352352
updated(props) {
@@ -365,11 +365,11 @@ class FrameGraphTable extends LitElement {
365365
}
366366

367367
_toggleCollapse(resourceIndex) {
368-
if (this.collapsedResources.has(resourceIndex)) {
369-
this.collapsedResources.delete(resourceIndex);
368+
if (this.expandedResourceSet.has(resourceIndex)) {
369+
this.expandedResourceSet.delete(resourceIndex);
370370
}
371371
else {
372-
this.collapsedResources.add(resourceIndex);
372+
this.expandedResourceSet.add(resourceIndex);
373373
}
374374
this.requestUpdate();
375375
}
@@ -430,9 +430,9 @@ class FrameGraphTable extends LitElement {
430430
.map(subresource => subresource.id);
431431

432432
const hasSubresources = subresourceIds.length > 0;
433-
const isCollapsed = this.collapsedResources.has(resourceIndex);
433+
const isExpanded = this.expandedResourceSet.has(resourceIndex);
434434
// Show the aggregated resource usage when the subresources are collapsed.
435-
const resourceIds = isCollapsed ? [resource.id, ...subresourceIds]:[resource.id];
435+
const resourceIds = isExpanded ? [resource.id]:[resource.id, ...subresourceIds];
436436

437437
const onClickResource = () => this._handleResourceClick(resource.id);
438438
const selectedStyle = resource.id === this.selectedResourceId ? "selected" : "";
@@ -444,15 +444,15 @@ class FrameGraphTable extends LitElement {
444444
? html`
445445
<span class="toggle-icon"
446446
@click="${(e) => { e.stopPropagation(); this._toggleCollapse(resourceIndex); }}">
447-
${isCollapsed ? '' : ''}
447+
${isExpanded ? '' : ''}
448448
</span>`
449449
: nothing}
450450
${resource.name}
451-
${hasSubresources && isCollapsed ? html`(${subresourceIds.length})` : nothing}
451+
${hasSubresources && isExpanded ? nothing : html`(${subresourceIds.length})`}
452452
</th>
453453
${this._renderResourceUsage(allPasses, resourceIds, DEFAULT_COLOR)}
454454
</tr>
455-
${!isCollapsed ? this._renderSubresourceRows(resources, resource, resourceIndex, allPasses) : nothing}
455+
${isExpanded ? this._renderSubresourceRows(resources, resource, resourceIndex, allPasses) : nothing}
456456
`;
457457
}
458458

0 commit comments

Comments
 (0)