Skip to content

Commit

Permalink
docs: Rect extension docs is out of date (#1451)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfenrain committed Mar 15, 2022
1 parent e32dd32 commit 7e50572
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
13 changes: 9 additions & 4 deletions doc/flame/other/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ Methods:
- `brighten`: Brighten the shade of the color by an amount between 0 to 1.

Factories:
- `fromRGBHexString`: Parses an RGB color from a valid hex string (e.g. #1C1C1C).
- `fromARGBHexString`: Parses an ARGB color from a valid hex string (e.g. #FF1C1C1C).
- `ColorExtension.fromRGBHexString`: Parses an RGB color from a valid hex string (e.g. #1C1C1C).
- `ColorExtension.fromARGBHexString`: Parses an ARGB color from a valid hex string (e.g. #FF1C1C1C).

### Image

Expand Down Expand Up @@ -195,6 +195,11 @@ Methods:
- `toVertices`: Turns the four corners of the `Rect` into a list of `Vector2`.
- `toMathRectangle`: Converts this `Rect` into a `math.Rectangle`.
- `toGeometryRectangle`: Converts this `Rect` into a `Rectangle` from flame-geom.
- `transform`: Transforms the `Rect` using a `Matrix4`.

Factories:
- `RectExtension.fromBounds`: Construct a `Rect` that represents the bounds of a list of `Vector2`s.
- `RectExtension.fromVector2Center`: Construct a `Rect` from a center point.

### math.Rectangle

Expand Down Expand Up @@ -228,7 +233,7 @@ Methods:
- `moveToTarget`: Smoothly moves a Vector2 in the target direction by a given distance.

Factories:
- `fromInts`: Create a `Vector2` with ints as input.
- `Vector2Extension.fromInts`: Create a `Vector2` with ints as input.

Operators:
- `&`: Combines two `Vector2`s to form a Rect, the origin should be on the left and the size on the
Expand Down Expand Up @@ -264,5 +269,5 @@ Getters:
- `m44`: The fourth row and fourth column.

Factories:
- `scale`: Create a scaled `Matrix4`. Either by passing a `Vector4` or `Vector2` as it's first
- `Matrix4Extension.scale`: Create a scaled `Matrix4`. Either by passing a `Vector4` or `Vector2` as it's first
argument, or by passing x y z doubles.
5 changes: 2 additions & 3 deletions packages/flame/lib/src/extensions/rect.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ extension RectExtension on Rect {
);
}

/// Creates bounds in from of a [Rect] from a list of [Vector2]
/// Creates a [Rect] that represents the bounds of the list [pts].
static Rect fromBounds(List<Vector2> pts) {
final minX = pts.map((e) => e.x).reduce(min);
final maxX = pts.map((e) => e.x).reduce(max);
Expand All @@ -83,8 +83,7 @@ extension RectExtension on Rect {
return Rect.fromPoints(Offset(minX, minY), Offset(maxX, maxY));
}

/// Constructs a rectangle from its center point (specified as a Vector2),
/// width and height.
/// Constructs a [Rect] with a [width] and [height] around the [center] point.
static Rect fromVector2Center({
required Vector2 center,
required double width,
Expand Down

0 comments on commit 7e50572

Please sign in to comment.