File tree 3 files changed +20
-19
lines changed
3 files changed +20
-19
lines changed Original file line number Diff line number Diff line change @@ -291,8 +291,6 @@ export class LayoutSystem
291
291
*/
292
292
export class Layout extends Container
293
293
{
294
- override layout : LayoutSystem ;
295
-
296
294
/**
297
295
* Creates layout container.
298
296
* @param options
@@ -301,7 +299,7 @@ export class Layout extends Container
301
299
{
302
300
super ( ) ;
303
301
304
- this . layout = new LayoutSystem ( options , this ) ;
302
+ this . initLayout ( options ) ;
305
303
}
306
304
307
305
/** Get {@link SizeController} */
@@ -442,6 +440,7 @@ declare module '@pixi/display'
442
440
{
443
441
initLayout ( config ?: LayoutOptions ) : Container ;
444
442
layout ?: LayoutSystem ;
443
+ isPixiLayout ?: boolean ;
445
444
}
446
445
}
447
446
@@ -453,6 +452,7 @@ if (!Container.prototype.initLayout)
453
452
if ( ! this . layout )
454
453
{
455
454
this . layout = new LayoutSystem ( options , this ) ;
455
+ this . isPixiLayout = true ;
456
456
}
457
457
458
458
return this ;
Original file line number Diff line number Diff line change @@ -119,17 +119,17 @@ export class AlignController
119
119
let childMarginTop = 0 ;
120
120
let childMarginBottom = 0 ;
121
121
122
- if ( child instanceof Layout )
122
+ if ( child . isPixiLayout )
123
123
{
124
- childDisplay = child . style . display ;
125
- const childPosition = child . style . position ;
124
+ const childLayout = child . layout as LayoutSystem ;
126
125
127
- childMarginLeft = child . style . marginLeft ;
128
- childMarginRight = child . style . marginRight ;
129
- childMarginTop = child . style . marginTop ;
130
- childMarginBottom = child . style . marginBottom ;
126
+ childDisplay = childLayout . style . display ;
127
+ childMarginLeft = childLayout . style . marginLeft ;
128
+ childMarginRight = childLayout . style . marginRight ;
129
+ childMarginTop = childLayout . style . marginTop ;
130
+ childMarginBottom = childLayout . style . marginBottom ;
131
131
132
- if ( childPosition !== undefined )
132
+ if ( childLayout . style . position !== undefined )
133
133
{
134
134
// this layout position will be handled by it's own controller
135
135
return ;
Original file line number Diff line number Diff line change @@ -226,9 +226,9 @@ export class ContentController
226
226
{
227
227
this . children . forEach ( ( child ) =>
228
228
{
229
- if ( child instanceof Layout )
229
+ if ( child . isPixiLayout )
230
230
{
231
- child . resize ( width , height ) ;
231
+ child . layout . resize ( width , height ) ;
232
232
}
233
233
} ) ;
234
234
}
@@ -269,15 +269,16 @@ export class ContentController
269
269
{
270
270
if ( typeof content === 'string' ) return 'string' ;
271
271
272
- if ( content instanceof Layout ) return 'layout' ;
273
-
274
272
if ( content instanceof Text ) return 'text' ;
275
273
276
- if ( content instanceof Sprite ) return 'container' ;
277
-
278
- if ( content instanceof Graphics ) return 'container' ;
274
+ if ( content instanceof Sprite
275
+ || content instanceof Graphics
276
+ || content instanceof Container )
277
+ {
278
+ if ( content . isPixiLayout ) return 'layout' ;
279
279
280
- if ( content instanceof Container ) return 'container' ;
280
+ return 'container' ;
281
+ }
281
282
282
283
if ( Array . isArray ( content ) ) return 'array' ;
283
284
You can’t perform that action at this time.
0 commit comments