 
 (def mouse-click (from-event canvas "click"))
 
-(def cycle-color
-  (tconcat (.takeUntil red mouse-click)
-          (defer #(tconcat (.takeUntil blue mouse-click)
-                          cycle-color))))
-
-(-> (.zip sine-wave cycle-color #(vector % %2))
-    (.take 600)
-    (.subscribe (fn [[{:keys [x y]} color]]
-                  (fill-rect x y color))))
+(def mouse-over (from-event canvas "over"))
 
 (defn write-text []
   (set! (.-font ctx) "20px Arial")
   (set! (.-fillStyle ctx) "white")
-  (.fillText ctx "Drugs" 530 780))
+  (.fillText ctx "Drugs" 780 780))
 
 (write-text)
 

    (.subscribe (fn [xysin]
                  (.log js/console (str xysin)))))

(defn fill-rect [x y color]
  (set! (.-fillStyle ctx) color)
  (.fillRect ctx x y 2 2))



(def color (.map sine-wave

(defn write-coordinate-labels []
  ())

(write-rotated-text)

(.log js/console "test new line ")
(.log js/console (str "Math.PI value:" Math/PI))

;;     context.beginPath();
;;      context.moveTo(100, 150);
;;      context.lineTo(450, 50);
;;      context.stroke();
(defn draw-line [x1 y1 x2 y2]
  (.beginPath ctx)
  (.moveTo ctx x1 y1)
  (.lineTo ctx x2 y2)
  (set! (.-strokeStyle ctx) "#B4B4B4")
  (.stroke ctx))

(def horizontal-grid-lines [{:x1 1450 :y1 600 :x2 150 :y2 600}])
(def vertical-grid-lines [{:x1 200 :y1 650 :x2 200 :y2 50 }])
(def horizontal-lines 6)
(def vertical-lines 13)

(doseq [{x1 :x1 y1 :y1 x2 :x2 y2 :y2} horizontal-grid-lines]
  (do
    (.log js/console (str "x1=" x1 " y1=" y1 " x2=" x2 " y2=" y2))
    (draw-line x1 y1 x2 y2)))

;;
;; draw the horizontal grid lines
;;
(doseq [{x1 :x1 y1 :y1 x2 :x2 y2 :y2} horizontal-grid-lines]
  (dotimes [n horizontal-lines] (.log js/console "Index: " n)
           (draw-line x1 (- y1 (* n 100)) x2 (- y2 (* n 100)))))

;;
;; draw the vertical grid lines
;;
(doseq [{x1 :x1 y1 :y1 x2 :x2 y2 :y2} vertical-grid-lines]
  (dotimes [n vertical-lines] (.log js/console "Index: " n)
           (draw-line (+ x1 (* n 100)) y1 (+ x2 (* n 100)) y2)))
