From a597f60baa40da450e8a2fb327623970b5dc8965 Mon Sep 17 00:00:00 2001 From: liyuxi Date: Fri, 10 May 2024 18:05:48 +0800 Subject: [PATCH 1/2] HotKey Signed-off-by: liyuxi --- ide/src/trace/component/SpKeyboard.html.ts | 6 +++++ ide/src/trace/component/trace/SpChartList.ts | 28 +++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/ide/src/trace/component/SpKeyboard.html.ts b/ide/src/trace/component/SpKeyboard.html.ts index ede6fa139..950ae9a30 100644 --- a/ide/src/trace/component/SpKeyboard.html.ts +++ b/ide/src/trace/component/SpKeyboard.html.ts @@ -201,6 +201,12 @@ table{ 展示/隐藏Vsync信号 + + +
b
+ + 展开/折叠收藏区域 + diff --git a/ide/src/trace/component/trace/SpChartList.ts b/ide/src/trace/component/trace/SpChartList.ts index ab922b7b5..a9392c601 100644 --- a/ide/src/trace/component/trace/SpChartList.ts +++ b/ide/src/trace/component/trace/SpChartList.ts @@ -93,7 +93,7 @@ export class SpChartList extends BaseElement { } private initChartListListener(): void { - this.icon1?.addEventListener('click', () => { + const foldCollect1 = () => { this.collect1Expand = !this.collect1Expand; if (this.collect1Expand) { this.icon1!.style.transform = 'rotateZ(0deg)'; @@ -103,8 +103,9 @@ export class SpChartList extends BaseElement { this.collectRowList1.forEach((row) => this.fragmentGroup1.appendChild(row)); } this.resizeHeight(); - }); - this.icon2?.addEventListener('click', () => { + } + this.icon1?.addEventListener('click', () => foldCollect1()); + const foldCollect2 = () => { this.collect2Expand = !this.collect2Expand; if (this.collect2Expand) { this.icon2!.style.transform = 'rotateZ(0deg)'; @@ -117,7 +118,26 @@ export class SpChartList extends BaseElement { this.resizeHeight(); this.scrollTop = 0; } - }); + } + this.icon2?.addEventListener('click', () => foldCollect2()); + document.addEventListener('keyup', e => { + if (e.key.toLowerCase() === 'b' && e.ctrlKey === false) { + const flag = this.collect1Expand === this.collect2Expand + if (flag) { + foldCollect1() + foldCollect2() + } else { + if (this.collect1Expand) { + foldCollect1() + } + else { + foldCollect2() + } + } + return + } + }) + this.removeCollectIcon1?.addEventListener('click', () => { for (let i = 0; i < this.collectRowList1.length; i++) { this.collectRowList1[i].collectEL?.click(); -- Gitee From a9030a58630a105c4c94d73c25b1e138d23cb16e Mon Sep 17 00:00:00 2001 From: LiYuxi Date: Tue, 4 Jun 2024 11:45:07 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E6=94=B6=E8=97=8F=E6=89=8B=E5=8A=A8=E6=8A=98=E5=8F=A0=E5=90=8E?= =?UTF-8?q?=E6=8C=89=E9=94=AE=E4=B8=8D=E8=A7=A6=E5=8F=91=E5=B1=95=E5=BC=80?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: LiYuxi --- ide/src/trace/component/trace/SpChartList.ts | 37 +++++++++++++------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/ide/src/trace/component/trace/SpChartList.ts b/ide/src/trace/component/trace/SpChartList.ts index a9392c601..005324182 100644 --- a/ide/src/trace/component/trace/SpChartList.ts +++ b/ide/src/trace/component/trace/SpChartList.ts @@ -110,31 +110,44 @@ export class SpChartList extends BaseElement { if (this.collect2Expand) { this.icon2!.style.transform = 'rotateZ(0deg)'; this.collectEl2?.appendChild(this.fragmentGroup2); - this.resizeHeight(); this.scrollTop = this.scrollHeight; } else { this.icon2!.style.transform = 'rotateZ(-90deg)'; this.collectRowList2.forEach((row) => this.fragmentGroup2.appendChild(row)); - this.resizeHeight(); this.scrollTop = 0; } + this.resizeHeight(); } this.icon2?.addEventListener('click', () => foldCollect2()); - document.addEventListener('keyup', e => { + document.addEventListener('keyup', (e) => { if (e.key.toLowerCase() === 'b' && e.ctrlKey === false) { - const flag = this.collect1Expand === this.collect2Expand - if (flag) { - foldCollect1() - foldCollect2() - } else { - if (this.collect1Expand) { + // 收藏夹有泳道时 为true + const hasChildNode1 = this.collectEl1?.hasChildNodes() || this.fragmentGroup1.hasChildNodes() + const hasChildNode2 = this.collectEl2?.hasChildNodes() || this.fragmentGroup2.hasChildNodes() + // 两个收藏夹都有泳道时 + if (hasChildNode1 && hasChildNode2) { + const flag = this.collect1Expand === this.collect2Expand + if (flag) { foldCollect1() - } - else { foldCollect2() + } else { + // 两收藏夹的折叠状态不一致 优先一起折叠 + if (this.collect1Expand) { + foldCollect1() + } + else { + foldCollect2() + } } + return + } + // 只影响有泳道的收藏夹 + if (hasChildNode1) { + foldCollect1() + } + if (hasChildNode2) { + foldCollect2() } - return } }) -- Gitee