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

Merge pull request #1971 from pylaligand/operator

Added a few operators to the Velocity class.
parents 91fa3701 a6c4927b
......@@ -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