From 16669da4f840c41fdbde808236dbedc4dc82d890 Mon Sep 17 00:00:00 2001 From: zhangzepeng Date: Thu, 8 Jun 2023 15:15:45 +0800 Subject: [PATCH] =?UTF-8?q?=E2=80=99=E7=BC=A9=E6=94=BE=E7=BB=98=E5=88=B6?= =?UTF-8?q?=E7=BA=BF=E8=B7=91=E5=8A=A8bug=E4=BF=AE=E6=94=B9=E2=80=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ide/src/trace/component/SpSystemTrace.ts | 14 +++++++------- ide/src/trace/component/trace/base/TraceRow.ts | 5 +++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ide/src/trace/component/SpSystemTrace.ts b/ide/src/trace/component/SpSystemTrace.ts index 2424b12b..1d569e89 100644 --- a/ide/src/trace/component/SpSystemTrace.ts +++ b/ide/src/trace/component/SpSystemTrace.ts @@ -664,11 +664,11 @@ export class SpSystemTrace extends BaseElement { }; // @ts-ignore new ResizeObserver((entries) => { - let width = entries[0].contentRect.width - 1 - SpSystemTrace.scrollViewWidth; + TraceRow.FRAME_WIDTH = this.clientWidth - 249; requestAnimationFrame(() => { - this.timerShaftEL?.updateWidth(width); + this.timerShaftEL?.updateWidth(this.clientWidth); this.shadowRoot!.querySelectorAll>('trace-row').forEach((it) => { - it.updateWidth(width); + it.updateWidth(this.clientWidth); }); }); }).observe(this); @@ -991,14 +991,14 @@ export class SpSystemTrace extends BaseElement { drawFlagLineSegment(this.canvasPanelCtx, this.hoverFlag, this.selectFlag, { x: 0, y: 0, - width: this.timerShaftEL?.canvas?.clientWidth, + width: TraceRow.FRAME_WIDTH, height: this.canvasPanel?.clientHeight, }); //draw flag line segment for favorite canvas drawFlagLineSegment(this.canvasFavoritePanelCtx, this.hoverFlag, this.selectFlag, { x: 0, y: 0, - width: this.timerShaftEL?.canvas?.clientWidth, + width: TraceRow.FRAME_WIDTH, height: this.canvasFavoritePanel?.clientHeight, }); //draw wakeup for main canvas @@ -1011,7 +1011,7 @@ export class SpSystemTrace extends BaseElement { { x: 0, y: 0, - width: this.timerShaftEL!.canvas!.clientWidth, + width: TraceRow.FRAME_WIDTH, height: this.canvasPanel!.clientHeight!, } as Rect ); @@ -1025,7 +1025,7 @@ export class SpSystemTrace extends BaseElement { { x: 0, y: 0, - width: this.timerShaftEL!.canvas!.clientWidth, + width: TraceRow.FRAME_WIDTH, height: this.canvasFavoritePanel!.clientHeight!, } as Rect ); diff --git a/ide/src/trace/component/trace/base/TraceRow.ts b/ide/src/trace/component/trace/base/TraceRow.ts index 1ac6c041..8ab8ad4b 100644 --- a/ide/src/trace/component/trace/base/TraceRow.ts +++ b/ide/src/trace/component/trace/base/TraceRow.ts @@ -87,6 +87,7 @@ export class TraceRow extends HTMLElement { static ROW_TYPE_IRQ_GROUP = 'irq-group'; static ROW_TYPE_IRQ = 'irq'; static ROW_TYPE_JANK = 'janks'; + static FRAME_WIDTH: number = 0; static range: TimeRange | undefined | null; static rangeSelectObject: RangeSelectStruct | undefined; public obj: TraceRowObject | undefined | null; @@ -385,14 +386,14 @@ export class TraceRow extends HTMLElement { get frame(): Rect | any { if (this._frame) { - this._frame.width = (this.parentElement?.clientWidth || 0) - 248 - SpSystemTrace.scrollViewWidth; + this._frame.width = TraceRow.FRAME_WIDTH; this._frame.height = this.clientHeight; return this._frame; } else { this._frame = new Rect( 0, 0, - (this.parentElement?.clientWidth || 0) - 248 - SpSystemTrace.scrollViewWidth, + TraceRow.FRAME_WIDTH, this.clientHeight || 40 ); return this._frame; -- Gitee