@yuebai008/cli
Version:
Command line interface for rapid qg-minigame development
1 lines • 1.79 kB
JavaScript
import*as UI from"../../ui/legacy/legacy.js";import*as LayerViewer from"../layer_viewer/layer_viewer.js";export class TimelineLayersView extends UI.SplitWidget.SplitWidget{model;showPaintProfilerCallback;rightSplitWidget;layerViewHost;layers3DView;frameLayerTree;updateWhenVisible;constructor(e,i){super(!0,!1,"timelineLayersView"),this.model=e,this.showPaintProfilerCallback=i,this.element.classList.add("timeline-layers-view"),this.rightSplitWidget=new UI.SplitWidget.SplitWidget(!0,!0,"timelineLayersViewDetails"),this.rightSplitWidget.element.classList.add("timeline-layers-view-properties"),this.setMainWidget(this.rightSplitWidget);const t=new UI.Widget.VBox;this.setSidebarWidget(t),this.layerViewHost=new LayerViewer.LayerViewHost.LayerViewHost;const s=new LayerViewer.LayerTreeOutline.LayerTreeOutline(this.layerViewHost);t.element.appendChild(s.element),this.layers3DView=new LayerViewer.Layers3DView.Layers3DView(this.layerViewHost),this.layers3DView.addEventListener(LayerViewer.Layers3DView.Events.PaintProfilerRequested,this.onPaintProfilerRequested,this),this.rightSplitWidget.setMainWidget(this.layers3DView);const r=new LayerViewer.LayerDetailsView.LayerDetailsView(this.layerViewHost);this.rightSplitWidget.setSidebarWidget(r),r.addEventListener(LayerViewer.LayerDetailsView.Events.PaintProfilerRequested,this.onPaintProfilerRequested,this)}showLayerTree(e){this.frameLayerTree=e,this.isShowing()?this.update():this.updateWhenVisible=!0}wasShown(){this.updateWhenVisible&&(this.updateWhenVisible=!1,this.update())}async onPaintProfilerRequested(e){const i=e.data,t=await this.layers3DView.snapshotForSelection(i);t&&this.showPaintProfilerCallback(t.snapshot)}update(){this.frameLayerTree&&this.frameLayerTree.layerTreePromise().then((e=>this.layerViewHost.setLayerTree(e)))}}