Skip to content

Commit

Permalink
fix(ModalDialog): overflow top when set IsDraggable to true (#4995)
Browse files Browse the repository at this point in the history
* fix(Dialog): 修复高度溢出问题

* chore: bump version 9.2.0-beta01

* chore: bump version 9.2.0-beta02

Co-Authored-By: Ye Jiancong <[email protected]>

---------

Co-authored-by: Ye Jiancong <[email protected]>
  • Loading branch information
ArgoZhang and Ye1105 authored Dec 30, 2024
1 parent 44afc80 commit 3d6591e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/BootstrapBlazor.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>9.2.0</Version>
<Version>9.2.0-beta01</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
10 changes: 8 additions & 2 deletions src/BootstrapBlazor/Components/Modal/ModalDialog.razor.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,17 @@ export function init(id) {
}

const update = el => {
const width = el.offsetWidth / 2;

const height = el.offsetHeight / 2;
const marginTop = parseFloat(getComputedStyle(el).marginTop);
const viewBoxHeight = window.innerHeight / 2;
if (viewBoxHeight - height - marginTop > 0) {
el.style.setProperty("margin-top", `calc(50vh - ${height}px)`);
}

const width = el.offsetWidth / 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');
}

Expand Down

0 comments on commit 3d6591e

Please sign in to comment.