Skip to content

Purpose of LayoutManager init values? #1

Description

@cambiata

Hi Joshua, and thank you for another (reborn) lib!

I'm a bit confused about the init values for the LayoutManager:

In the example below, one (100x100) sprite is to be managed.
If I don't feed the LayoutManager with (100, 100), then it doesn't work...

Does this mean that I have to feed the LayoutManager with the initial size of every object, or am I missing something here..?

/ Jonas

class Main extends Sprite 
{
    var layoutManager:LayoutManager;

    function init() 
    {
        var sprite:Sprite = new Sprite();
        sprite.graphics.beginFill(0xFF0000);
        sprite.graphics.drawRect(0, 0, 100, 100);
        this.addChild(sprite);

        layoutManager = new LayoutManager(100, 100);    // <-- Needs to be same size as the sprite to manage???
        layoutManager.addItem(new LayoutItem(sprite, LayoutType.RIGHT, LayoutType.BOTTOM));
        layoutManager.layoutItems();
        resize();
    }

    function resize(e:Event=null) 
    {
        layoutManager.resize(Lib.current.stage.stageWidth, Lib.current.stage.stageHeight);
    }

...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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