mirror of
				https://github.com/flame-engine/flame.git
				synced 2025-10-31 17:06:50 +08:00 
			
		
		
		
	 ccee9a466b
			
		
	
	ccee9a466b
	
	
	
		
			
			* 👌 Use `Offset` type directly in `JoystickAction.update` calculations (#631) * Move files to src and comply with the dart package layout convention * Fixing widgets example Co-authored-by: Serge Matveenko <lig@countzero.co> Co-authored-by: Erick Zanardo <erickzanardoo@gmail.com>
		
			
				
	
	
		
			21 lines
		
	
	
		
			487 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			487 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'dart:math';
 | |
| import 'dart:ui';
 | |
| 
 | |
| import 'vector2.dart';
 | |
| 
 | |
| export 'dart:ui' show Size;
 | |
| 
 | |
| extension SizeExtension on Size {
 | |
|   /// Creates an [Offset] from the [Size]
 | |
|   Offset toOffset() => Offset(width, height);
 | |
| 
 | |
|   /// Creates a [Vector2] from the [Size]
 | |
|   Vector2 toVector2() => Vector2(width, height);
 | |
| 
 | |
|   /// Creates a [Point] from the [Size]
 | |
|   Point toPoint() => Point(width, height);
 | |
| 
 | |
|   /// Creates a [Rect] from the [Size]
 | |
|   Rect toRect() => Rect.fromLTWH(0, 0, width, height);
 | |
| }
 |