From 809718102cf89cc1fe210ae439b35693bc31a8bb Mon Sep 17 00:00:00 2001 From: Jeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com> Date: Mon, 4 Jul 2022 09:39:27 -0400 Subject: [PATCH] Improved sidebar width handling and added scrolling to the selected pass when loading urls (#3834) --- static/panes/llvm-opt-pipeline.ts | 32 ++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/static/panes/llvm-opt-pipeline.ts b/static/panes/llvm-opt-pipeline.ts index 324428eb0..33d7342cc 100644 --- a/static/panes/llvm-opt-pipeline.ts +++ b/static/panes/llvm-opt-pipeline.ts @@ -43,6 +43,8 @@ import { LLVMOptPipelineOutput, } from '../../types/compilation/llvm-opt-pipeline-output.interfaces'; +const MIN_SIDEBAR_WIDTH = 100; + export class LLVMOptPipeline extends MonacoPane { results: LLVMOptPipelineOutput = {}; passesColumn: JQuery; @@ -62,6 +64,7 @@ export class LLVMOptPipeline extends MonacoPane void; resizeDragEndBind: (e: MouseEvent) => void; + firstResults = true; constructor(hub: Hub, container: Container, state: LLVMOptPipelineViewState & MonacoPaneState) { super(hub, container, state); @@ -69,10 +72,18 @@ export class LLVMOptPipeline extends MonacoPane { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + state.sidebarWidth = parseInt( + document.defaultView!.getComputedStyle(this.passesColumn.get()[0]).width, + 10 + ); + state.sidebarWidth = Math.max(state.sidebarWidth, MIN_SIDEBAR_WIDTH); + this.resize(); + this.updateState(); + }); } else { + state.sidebarWidth = Math.max(state.sidebarWidth, MIN_SIDEBAR_WIDTH); this.passesColumn.get()[0].style.width = state.sidebarWidth + 'px'; } this.state = state; @@ -153,8 +164,8 @@ export class LLVMOptPipeline extends MonacoPane