Skip to content

Commit 908fde2

Browse files
committed
Add example for box_transform.
1 parent cf6d200 commit 908fde2

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
## Resizing a Box
3+
4+
```dart
5+
final Box rect = Box.fromLTWH(50, 50, 100, 100);
6+
7+
final ResizeResult result = BoxTransformer.resize(
8+
handle: HandlePosition.bottomRight, // handle that is being dragged
9+
initialRect: rect,
10+
initialLocalPosition: Vector2.zero(),
11+
localPosition: Vector2.zero(),
12+
resizeMode: ResizeMode.freeform,
13+
initialFlip: Flip.none,
14+
);
15+
16+
result.rect; // the new rect
17+
```
18+
19+
## Moving a box.
20+
21+
```dart title="Moving a box"
22+
final Box rect = Box.fromLTWH(50, 50, 100, 100);
23+
final MoveResult result = BoxTransformer.move(
24+
initialRect: rect,
25+
initialLocalPosition: Vector2.zero(),
26+
localPosition: Vector2.zero(),
27+
);
28+
29+
result.position; // the new position of the box
30+
```

0 commit comments

Comments
 (0)