38 lines
1.1 KiB
MonkeyC
38 lines
1.1 KiB
MonkeyC
import Toybox.Graphics;
|
|
import Toybox.Lang;
|
|
import Toybox.WatchUi;
|
|
|
|
class ArabicMark extends IMark {
|
|
|
|
var InnerRadius as Float = 0.9;
|
|
var Font as Graphics.FontType = Graphics.FONT_SMALL;
|
|
|
|
function initialize(options as IMark.MarkParams) {
|
|
IMark.initialize(options);
|
|
}
|
|
|
|
function drawMark(dc as Dc, x as Float, y as Float, length as Float) as Void {
|
|
if (Seconds % 5 != 0) {
|
|
// it doesn't support anything that in-between
|
|
return;
|
|
}
|
|
|
|
var angle = Math.toRadians(Seconds * 6.0 - 90);
|
|
var text = secondsToText();
|
|
var dimentions = dc.getTextDimensions(text, Font);
|
|
|
|
dc.setColor(Color, Graphics.COLOR_TRANSPARENT);
|
|
dc.drawText(x + length * InnerRadius * Math.cos(angle) - dimentions[0] / 2.0,
|
|
y + length * InnerRadius * Math.sin(angle) - dimentions[1] / 2.0,
|
|
Font, text, Graphics.TEXT_JUSTIFY_LEFT);
|
|
}
|
|
|
|
function secondsToText() as String? {
|
|
var hours = Seconds / 5;
|
|
if (hours == 0) {
|
|
hours = 12;
|
|
}
|
|
|
|
return hours.toString();
|
|
}
|
|
} |