From 6a1dbc61bc096a083062d71573431b4ddb636338 Mon Sep 17 00:00:00 2001 From: zhaokaishan Date: Tue, 21 Mar 2023 11:23:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=94=B6=E8=97=8F=E5=A4=B9=E5=85=83?= =?UTF-8?q?=E7=B4=A0=E6=94=AF=E6=8C=81=E6=8B=96=E5=8A=A8=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhaokaishan --- host/ide/src/trace/component/SpSystemTrace.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/host/ide/src/trace/component/SpSystemTrace.ts b/host/ide/src/trace/component/SpSystemTrace.ts index 1730ec4..b244be0 100644 --- a/host/ide/src/trace/component/SpSystemTrace.ts +++ b/host/ide/src/trace/component/SpSystemTrace.ts @@ -193,13 +193,20 @@ export class SpSystemTrace extends BaseElement { currentRow.addEventListener("dragstart", () => { this.currentClickRow = currentRow; }); - currentRow.addEventListener("dragover", (event: any) => { - event.preventDefault(); - event.dataTransfer.dropEffect = "move"; + currentRow.addEventListener("dragover", (ev: any) => { + ev.preventDefault(); + ev.dataTransfer.dropEffect = "move"; }); - currentRow.addEventListener("drop", () => { - if (this.currentClickRow !== currentRow) { - this.favoriteRowsEL?.insertBefore(this.currentClickRow!, currentRow); + currentRow.addEventListener("drop", (ev: any) => { + if (this.currentClickRow != null && this.currentClickRow !== currentRow) { + let rect = currentRow.getBoundingClientRect(); + if (ev.clientY >= rect.top && ev.clientY < rect.top + rect.height / 2) { //上面 + console.log("向上移动"); + this.favoriteRowsEL?.insertBefore(this.currentClickRow!, currentRow); + } else if (ev.clientY <= rect.bottom && ev.clientY > rect.top + rect.height / 2) { //下面 + console.log("向下移动"); + this.favoriteRowsEL?.insertBefore(currentRow, this.currentClickRow!); + } this.refreshFavoriteCanvas(); } }); -- Gitee From d5e783bc46cd221f8977d420d9e1008d9a48715f Mon Sep 17 00:00:00 2001 From: zhaokaishan Date: Tue, 21 Mar 2023 11:27:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=94=B6=E8=97=8F=E5=A4=B9=E5=85=83?= =?UTF-8?q?=E7=B4=A0=E6=94=AF=E6=8C=81=E6=8B=96=E5=8A=A8=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhaokaishan --- host/ide/src/trace/component/SpSystemTrace.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/host/ide/src/trace/component/SpSystemTrace.ts b/host/ide/src/trace/component/SpSystemTrace.ts index b244be0..7b3fa61 100644 --- a/host/ide/src/trace/component/SpSystemTrace.ts +++ b/host/ide/src/trace/component/SpSystemTrace.ts @@ -200,11 +200,9 @@ export class SpSystemTrace extends BaseElement { currentRow.addEventListener("drop", (ev: any) => { if (this.currentClickRow != null && this.currentClickRow !== currentRow) { let rect = currentRow.getBoundingClientRect(); - if (ev.clientY >= rect.top && ev.clientY < rect.top + rect.height / 2) { //上面 - console.log("向上移动"); + if (ev.clientY >= rect.top && ev.clientY < rect.top + rect.height / 2) { //向上移动 this.favoriteRowsEL?.insertBefore(this.currentClickRow!, currentRow); - } else if (ev.clientY <= rect.bottom && ev.clientY > rect.top + rect.height / 2) { //下面 - console.log("向下移动"); + } else if (ev.clientY <= rect.bottom && ev.clientY > rect.top + rect.height / 2) { //向下移动 this.favoriteRowsEL?.insertBefore(currentRow, this.currentClickRow!); } this.refreshFavoriteCanvas(); -- Gitee