@@ -11,6 +11,9 @@ class Window extends dn.Process {
11
11
public static var ALL : Array <Window > = [];
12
12
static var MODAL_COUNT = 0 ;
13
13
14
+ var uiWid (get ,never ) : Int ; inline function get_uiWid () return M .ceil ( w ()/ Const .UI_SCALE );
15
+ var uiHei (get ,never ) : Int ; inline function get_uiHei () return M .ceil ( h ()/ Const .UI_SCALE );
16
+
14
17
public var content : h2d. Flow ;
15
18
16
19
var ca : ControllerAccess <GameAction >;
@@ -150,35 +153,32 @@ class Window extends dn.Process {
150
153
151
154
root .setScale (Const .UI_SCALE );
152
155
153
- var wid = M .ceil ( w ()/ Const .UI_SCALE );
154
- var hei = M .ceil ( h ()/ Const .UI_SCALE );
155
-
156
156
// Horizontal
157
157
if ( horizontalAlign == Fill )
158
- content .minWidth = content .maxWidth = wid ;
158
+ content .minWidth = content .maxWidth = uiWid ;
159
159
160
160
switch horizontalAlign {
161
161
case Start : content .x = 0 ;
162
- case End : content .x = wid - content .outerWidth ;
163
- case Center : content .x = Std .int ( wid * 0.5 - content .outerWidth * 0.5 + modalIdx * 8 );
164
- case Fill : content .x = 0 ; content .minWidth = content .maxWidth = wid ;
162
+ case End : content .x = uiWid - content .outerWidth ;
163
+ case Center : content .x = Std .int ( uiWid * 0.5 - content .outerWidth * 0.5 + modalIdx * 8 );
164
+ case Fill : content .x = 0 ; content .minWidth = content .maxWidth = uiWid ;
165
165
}
166
166
167
167
// Vertical
168
168
if ( verticalAlign == Fill )
169
- content .minHeight = content .maxHeight = hei ;
169
+ content .minHeight = content .maxHeight = uiHei ;
170
170
171
171
switch verticalAlign {
172
172
case Start : content .y = 0 ;
173
- case End : content .y = hei - content .outerHeight ;
174
- case Center : content .y = Std .int ( hei * 0.5 - content .outerHeight * 0.5 + modalIdx * 4 );
175
- case Fill : content .y = 0 ; content .minHeight = content .maxHeight = hei ;
173
+ case End : content .y = uiHei - content .outerHeight ;
174
+ case Center : content .y = Std .int ( uiHei * 0.5 - content .outerHeight * 0.5 + modalIdx * 4 );
175
+ case Fill : content .y = 0 ; content .minHeight = content .maxHeight = uiHei ;
176
176
}
177
177
178
178
// Mask
179
179
if ( mask != null ) {
180
- mask .minWidth = wid ;
181
- mask .minHeight = hei ;
180
+ mask .minWidth = uiWid ;
181
+ mask .minHeight = uiHei ;
182
182
}
183
183
}
184
184
0 commit comments