box_transform 0.4.4-dev.2 box_transform: ^0.4.4-dev.2 copied to clipboard
A pure dart implementation of advanced 2D box transformation with easy and simple API.
Resizing a Box #
final Box rect = Box.fromLTWH(50, 50, 100, 100);
final ResizeResult result = BoxTransformer.resize(
handle: HandlePosition.bottomRight, // handle that is being dragged
initialRect: rect,
initialLocalPosition: Vector2.zero(),
localPosition: Vector2.zero(),
resizeMode: ResizeMode.freeform,
initialFlip: Flip.none,
);
result.rect; // the new rect
Moving a box. #
final Box rect = Box.fromLTWH(50, 50, 100, 100);
final MoveResult result = BoxTransformer.move(
initialRect: rect,
initialLocalPosition: Vector2.zero(),
localPosition: Vector2.zero(),
);
result.position; // the new position of the box