From 549f6880a8cf857d0bff15936c8e9fe096479860 Mon Sep 17 00:00:00 2001 From: Argo-AsicoTech Date: Sat, 16 Nov 2024 13:06:16 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E5=89=8D=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Modal/ModalDialog.razor.js | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.js b/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.js index 6a779c85e6b..e8d8acc106f 100644 --- a/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.js +++ b/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.js @@ -121,15 +121,30 @@ export function init(id) { } if (el.classList.contains('is-draggable-center')) { - const width = el.offsetWidth / 2; - const height = el.offsetHeight / 2; + const check = () => { + if (el.offsetWidth > 0) { + clearInterval(dialog.handler); + delete dialog.handler; - el.style.setProperty("margin-left", `calc(50vw - ${width}px)`); - el.style.setProperty("margin-top", `calc(50vh - ${height}px)`); - el.classList.remove('is-draggable-center'); + update(el); + } + else { + requestAnimationFrame(check); + } + } + requestAnimationFrame(check); } } +const update = el => { + const width = el.offsetWidth / 2; + const height = el.offsetHeight / 2; + + el.style.setProperty("margin-left", `calc(50vw - ${width}px)`); + el.style.setProperty("margin-top", `calc(50vh - ${height}px)`); + el.classList.remove('is-draggable-center'); +} + export function dispose(id) { const dialog = Data.get(id) Data.remove(id) From f670dcb808d76114b6baa9ce69c5e6a8df249410 Mon Sep 17 00:00:00 2001 From: Argo-AsicoTech Date: Sat, 16 Nov 2024 13:06:42 +0800 Subject: [PATCH 2/3] chore: bump version 9.0.1-beta02 --- src/BootstrapBlazor/BootstrapBlazor.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index 46f70311041..4bed1410bd6 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 9.0.0-beta03 + 9.0.1-beta02 From 1c06d31e06afcdc54cb5cf47176056eebe83c4b7 Mon Sep 17 00:00:00 2001 From: Argo-AsicoTech Date: Sat, 16 Nov 2024 15:52:30 +0800 Subject: [PATCH 3/3] =?UTF-8?q?refactor:=20=E7=B2=BE=E7=AE=80=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Modal/ModalDialog.razor.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.js b/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.js index e8d8acc106f..e1603d2c9d5 100644 --- a/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.js +++ b/src/BootstrapBlazor/Components/Modal/ModalDialog.razor.js @@ -123,9 +123,6 @@ export function init(id) { if (el.classList.contains('is-draggable-center')) { const check = () => { if (el.offsetWidth > 0) { - clearInterval(dialog.handler); - delete dialog.handler; - update(el); } else {