initial commit
This commit is contained in:
23
source/Utils.mc
Normal file
23
source/Utils.mc
Normal file
@ -0,0 +1,23 @@
|
||||
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]];
|
||||
}
|
||||
Reference in New Issue
Block a user