mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-03 12:28:03 +08:00
21 lines
491 B
Dart
21 lines
491 B
Dart
export 'dart:ui' show Offset;
|
|
|
|
import 'dart:math';
|
|
import 'dart:ui';
|
|
|
|
import './vector2.dart';
|
|
|
|
extension OffsetExtension on Offset {
|
|
/// Creates an [Vector2] from the [Offset]
|
|
Vector2 toVector2() => Vector2(dx, dy);
|
|
|
|
/// Creates a [Size] from the [Offset]
|
|
Size toSize() => Size(dx, dy);
|
|
|
|
/// Creates a [Point] from the [Offset]
|
|
Point toPoint() => Point(dx, dy);
|
|
|
|
/// Creates a [Rect] starting in origin and going the [Offset]
|
|
Rect toRect() => Rect.fromLTWH(0, 0, dx, dy);
|
|
}
|