24 lines
568 B
MonkeyC
24 lines
568 B
MonkeyC
import Toybox.Lang;
|
|
import Toybox.Graphics;
|
|
|
|
// no types here, because this is generic, which are not supported by language
|
|
function getOrElse(value, defaultValue) {
|
|
if (value == null) {
|
|
return defaultValue;
|
|
} else {
|
|
return value;
|
|
}
|
|
}
|
|
|
|
function min(left as Numeric, right as Numeric) as Numeric {
|
|
if (left < right) {
|
|
return left;
|
|
} else {
|
|
return right;
|
|
}
|
|
}
|
|
|
|
function getCenter(dc as Dc, shift as [Float, Float]) as [Float, Float] {
|
|
return [dc.getWidth() / 2.0 + shift[0], dc.getHeight() / 2.0 + shift[1]];
|
|
}
|