Commit 56ef57c 1 parent 9a09c24 commit 56ef57c Copy full SHA for 56ef57c
File tree 2 files changed +19
-7
lines changed
2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 1
1
<Project Sdk =" Microsoft.NET.Sdk.Razor" >
2
2
3
3
<PropertyGroup >
4
- <Version >9.0.0-beta03 </Version >
4
+ <Version >9.0.1-beta02 </Version >
5
5
</PropertyGroup >
6
6
7
7
<ItemGroup >
Original file line number Diff line number Diff line change @@ -121,15 +121,27 @@ export function init(id) {
121
121
}
122
122
123
123
if ( el . classList . contains ( 'is-draggable-center' ) ) {
124
- const width = el . offsetWidth / 2 ;
125
- const height = el . offsetHeight / 2 ;
126
-
127
- el . style . setProperty ( "margin-left" , `calc(50vw - ${ width } px)` ) ;
128
- el . style . setProperty ( "margin-top" , `calc(50vh - ${ height } px)` ) ;
129
- el . classList . remove ( 'is-draggable-center' ) ;
124
+ const check = ( ) => {
125
+ if ( el . offsetWidth > 0 ) {
126
+ update ( el ) ;
127
+ }
128
+ else {
129
+ requestAnimationFrame ( check ) ;
130
+ }
131
+ }
132
+ requestAnimationFrame ( check ) ;
130
133
}
131
134
}
132
135
136
+ const update = el => {
137
+ const width = el . offsetWidth / 2 ;
138
+ const height = el . offsetHeight / 2 ;
139
+
140
+ el . style . setProperty ( "margin-left" , `calc(50vw - ${ width } px)` ) ;
141
+ el . style . setProperty ( "margin-top" , `calc(50vh - ${ height } px)` ) ;
142
+ el . classList . remove ( 'is-draggable-center' ) ;
143
+ }
144
+
133
145
export function dispose ( id ) {
134
146
const dialog = Data . get ( id )
135
147
Data . remove ( id )
You can’t perform that action at this time.
0 commit comments