From 55fc26a47f9c5f5b3f7fa3d1d5c702c332e40b1a Mon Sep 17 00:00:00 2001 From: Dmytro Soldatov Date: Mon, 28 Aug 2023 11:56:43 +0300 Subject: [PATCH] fix issue --- src/controllers/AlignController.ts | 8 ++++++++ src/stories/PixiUI/FancyButton.stories.ts | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/controllers/AlignController.ts b/src/controllers/AlignController.ts index 9ed31a5..8482a42 100644 --- a/src/controllers/AlignController.ts +++ b/src/controllers/AlignController.ts @@ -1,6 +1,8 @@ import { Layout, LayoutSystem } from '../Layout'; import { Text } from '@pixi/text'; import { isItJustAText } from '../utils/helpers'; +import { FancyButton } from '@pixi/ui'; +import { Container } from '@pixi/display'; /** Align controller manages {@link LayoutSystem} and it's content alignment. */ export class AlignController @@ -139,6 +141,12 @@ export class AlignController let anchorX = 0; let anchorY = 0; + if ((child as any).anchor && (child as any).anchor.x && (child as any).anchor.y) + { + anchorX = -(child as any).anchor.x * child.width; + anchorY = -(child as any).anchor.y * child.height; + } + if (style.position === undefined) { // if position is set, anchor will be handled in setSelfPosition method diff --git a/src/stories/PixiUI/FancyButton.stories.ts b/src/stories/PixiUI/FancyButton.stories.ts index 8e71205..5b02530 100644 --- a/src/stories/PixiUI/FancyButton.stories.ts +++ b/src/stories/PixiUI/FancyButton.stories.ts @@ -75,7 +75,6 @@ class LayoutStory private createLayout({ maxWidth }: any) { this.layout = new Layout({ - id: 'root', content: this.getButton(), styles: { background: 'black',