Commit a6c4927b authored by P.Y. Laligand's avatar P.Y. Laligand

Added a few operators to the Velocity class.

#1968
parent 49c0ec34
......@@ -218,6 +218,16 @@ class Velocity {
/// The number of pixels per second of velocity in the x and y directions.
final Offset pixelsPerSecond;
Velocity operator -() => new Velocity(pixelsPerSecond: -pixelsPerSecond);
Velocity operator -(Velocity other) {
return new Velocity(
pixelsPerSecond: pixelsPerSecond - other.pixelsPerSecond);
}
Velocity operator +(Velocity other) {
return new Velocity(
pixelsPerSecond: pixelsPerSecond + other.pixelsPerSecond);
}
bool operator ==(dynamic other) {
if (other is! Velocity)
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment