couple view and controller + offset working
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import 'dart:ui';
|
||||
|
||||
/// Convert grid space coordinates to screen space coordinates
|
||||
Offset gsToSs(Offset gsPosition, Offset gsTopLeft) {
|
||||
return gsPosition - gsTopLeft;
|
||||
}
|
||||
|
||||
/// Convert screen space coordinates to grid space coordinates
|
||||
Offset ssToGs(Offset ssPosition, Offset gsTopLeft) {
|
||||
return ssPosition + gsTopLeft;
|
||||
}
|
||||
@@ -6,4 +6,8 @@ extension OffsetCartesionOps on Offset {
|
||||
final dy = this.dy - other.dy;
|
||||
return dx * dx + dy * dy;
|
||||
}
|
||||
|
||||
Offset operator -(Offset other) {
|
||||
return Offset(dx - other.dx, dy - other.dy);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user