Skip to content

Commit

Permalink
fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberDex committed Dec 17, 2023
1 parent e1d591b commit 7d68853
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/Layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,6 @@ export class LayoutSystem
*/
export class Layout extends Container
{
override layout: LayoutSystem;

/**
* Creates layout container.
* @param options
Expand All @@ -301,7 +299,7 @@ export class Layout extends Container
{
super();

this.layout = new LayoutSystem(options, this);
this.initLayout(options);
}

/** Get {@link SizeController} */
Expand Down Expand Up @@ -442,6 +440,7 @@ declare module '@pixi/display'
{
initLayout(config?: LayoutOptions): Container;
layout?: LayoutSystem;
isPixiLayout?: boolean;
}
}

Expand All @@ -453,6 +452,7 @@ if (!Container.prototype.initLayout)
if (!this.layout)
{
this.layout = new LayoutSystem(options, this);
this.isPixiLayout = true;
}

return this;
Expand Down
16 changes: 8 additions & 8 deletions src/controllers/AlignController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,17 @@ export class AlignController
let childMarginTop = 0;
let childMarginBottom = 0;

if (child instanceof Layout)
if (child.isPixiLayout)
{
childDisplay = child.style.display;
const childPosition = child.style.position;
const childLayout = child.layout as LayoutSystem;

childMarginLeft = child.style.marginLeft;
childMarginRight = child.style.marginRight;
childMarginTop = child.style.marginTop;
childMarginBottom = child.style.marginBottom;
childDisplay = childLayout.style.display;
childMarginLeft = childLayout.style.marginLeft;
childMarginRight = childLayout.style.marginRight;
childMarginTop = childLayout.style.marginTop;
childMarginBottom = childLayout.style.marginBottom;

if (childPosition !== undefined)
if (childLayout.style.position !== undefined)
{
// this layout position will be handled by it's own controller
return;
Expand Down
17 changes: 9 additions & 8 deletions src/controllers/ContentController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@ export class ContentController
{
this.children.forEach((child) =>
{
if (child instanceof Layout)
if (child.isPixiLayout)
{
child.resize(width, height);
child.layout.resize(width, height);
}
});
}
Expand Down Expand Up @@ -269,15 +269,16 @@ export class ContentController
{
if (typeof content === 'string') return 'string';

if (content instanceof Layout) return 'layout';

if (content instanceof Text) return 'text';

if (content instanceof Sprite) return 'container';

if (content instanceof Graphics) return 'container';
if (content instanceof Sprite
|| content instanceof Graphics
|| content instanceof Container)
{
if (content.isPixiLayout) return 'layout';

if (content instanceof Container) return 'container';
return 'container';
}

if (Array.isArray(content)) return 'array';

Expand Down

0 comments on commit 7d68853

Please sign in to comment.