Add OFF state to LedColor
[led-pattern-ed] / src / led-color-widgets.vala
index 258faec..e096fec 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 public enum LedColor {
+       OFF = 0,
        R = 1,
        G = 2,
        B = 4,
@@ -30,7 +31,7 @@ class LedColorWidget : Gtk.DrawingArea {
        public LedColor color;
 
        public LedColorWidget () {
-               color = LedColor.RGB;
+               color = LedColor.OFF;
        }
 
        public LedColorWidget.with_color (LedColor _color) {
@@ -47,7 +48,7 @@ class LedColorWidget : Gtk.DrawingArea {
                ctx.clip ();
 
                ctx.new_path ();
-               ctx.arc (width / 2.0, height / 2.0, width / 2.0, 0, 2 * Math.PI);
+               ctx.arc (width / 2.0, height / 2.0, Math.fmin (width, height) / 2.0, 0, 2 * Math.PI);
 
                ctx.clip ();