Skip to content

GridAlign doesn't work when only height parameter set #5019

@halilcakar

Description

@halilcakar

Version

  • Phaser Version: ^3.22.0
  • Operating system: Windows 10 Home Single Language | Version 1903
  • Browser: Chrome

Description

Phaser.Actions.GridAlign doesn't work when you only set height property as following.

Phaser.Actions.GridAlign(group.getChildren(), {
    height: 10,
    cellWidth: 32,
    cellHeight: 32,
    x: 100,
    y: 100
}); // this doesn't work

it's working when we only set width property like following:

Phaser.Actions.GridAlign(group.getChildren(), {
    width: 10,
    cellWidth: 32,
    cellHeight: 32,
    x: 100,
    y: 100
}); // this does work 

I'm not sure this is the expected behaviour.

Example Test Code

You can test it on labs this example. just try to remove width first and left height alone.
When you do the revers way set width and remove height it's working.

Additional Information

I believe this should work both way. Isn't it? :)
On the code we are already checking if there are properties (width and height) and storing them as

var widthSet = options.hasOwnProperty('width');
var heightSet = options.hasOwnProperty('height');

Is it possible to use these flag's as if we are gonna consider setting by width and/or height?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions