Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.0.0-beta03</Version>
<Version>9.0.1-beta02</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
25 changes: 20 additions & 5 deletions src/BootstrapBlazor/Components/Modal/ModalDialog.razor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down