Skip to content

Commit 3d6591e

Browse files
ArgoZhangYe1105
andauthored
fix(ModalDialog): overflow top when set IsDraggable to true (#4995)
* fix(Dialog): 修复高度溢出问题 * chore: bump version 9.2.0-beta01 * chore: bump version 9.2.0-beta02 Co-Authored-By: Ye Jiancong <60547439+ye1105@users.noreply.github.com> --------- Co-authored-by: Ye Jiancong <60547439+ye1105@users.noreply.github.com>
1 parent 44afc80 commit 3d6591e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/BootstrapBlazor/BootstrapBlazor.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.2.0</Version>
4+
<Version>9.2.0-beta01</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Components/Modal/ModalDialog.razor.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,17 @@ export function init(id) {
134134
}
135135

136136
const update = el => {
137-
const width = el.offsetWidth / 2;
137+
138138
const height = el.offsetHeight / 2;
139+
const marginTop = parseFloat(getComputedStyle(el).marginTop);
140+
const viewBoxHeight = window.innerHeight / 2;
141+
if (viewBoxHeight - height - marginTop > 0) {
142+
el.style.setProperty("margin-top", `calc(50vh - ${height}px)`);
143+
}
139144

145+
const width = el.offsetWidth / 2;
140146
el.style.setProperty("margin-left", `calc(50vw - ${width}px)`);
141-
el.style.setProperty("margin-top", `calc(50vh - ${height}px)`);
147+
142148
el.classList.remove('is-draggable-center');
143149
}
144150

0 commit comments

Comments
 (0)