Show occluded layers in SF view by default

The rects view should include visible + occluded layers by default and
only visible layers when the checkbox `only visible` is checked.

Currently it shows only visible layers in both cases

Bug: 262550235
Test: open a SF trace in winscope and check if occluded layer rects
appear

Change-Id: I288aa20a8f233439603d97d3d6e2bedbe26fab4b
This commit is contained in:
Nataniel Borges
2022-12-19 14:40:50 +00:00
parent d35d90d4fc
commit d24b8e89f7

View File

@@ -121,7 +121,7 @@ export class Presenter {
return rect;
}) ?? [];
this.displayIds = [];
const rects = this.entry.visibleLayers
const rects = this.getLayersForRectsView();
.sort((layer1: any, layer2: any) => {
const absZLayer1 = layer1.zOrderPath;
const absZLayer2 = layer2.zOrderPath;
@@ -148,6 +148,14 @@ export class Presenter {
return this.rectsToUiData(rects.concat(displayRects));
}
private getLayersForRectsView(): Layer[] {
const onlyVisible = this.hierarchyUserOptions["onlyVisible"]?.enabled ?? false;
// Show only visible layers or Visible + Occluded layers. Don't show all layers
// (flattenedLayers) because container layers are never meant to be displayed
return this.entry.flattenedLayers
.filter((it: any) => it.isVisible || (!onlyVisible && it.occludedBy.length > 0));
}
private updateSelectedTreeUiData() {
if (this.selectedHierarchyTree) {
this.uiData.propertiesTree = this.getTreeWithTransformedProperties(this.selectedHierarchyTree);