Skip to content

Commit

Permalink
fix issue
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberDex committed Aug 28, 2023
1 parent 3920634 commit 55fc26a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/controllers/AlignController.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/stories/PixiUI/FancyButton.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class LayoutStory
private createLayout({ maxWidth }: any)
{
this.layout = new Layout({
id: 'root',
content: this.getButton(),
styles: {
background: 'black',
Expand Down

0 comments on commit 55fc26a

Please sign in to comment.