Skip to content

Snap: Fix position bug when anchor is not top-left #67

@projectitis

Description

@projectitis

When a snap component (e.g. SnapRectangleComponent) has an anchor set - for eaxmple, to Anchor.center - then it will not position itself correctly when a position is set.

final rect = SnapRectangleComponent(
    size: Vector2(100, 50),
    paint: Paint()..color = const Color.fromARGB(255, 25, 111, 131),
);
rect.anchor = Anchor.center;
rect.position = Vector2(100, 50); // Parent is 200, 100

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions