Skip to content

Commit

Permalink
Update klipse.cljs
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwilk authored Mar 3, 2017
1 parent 658b7c6 commit 6f602d1
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/functions_as_patterns/klipse.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

(def rect-size 70)
(def rect-start 70)
(def indent (/ square-size 2))
(def stroke-size 2)

(def canvas-id (atom "canvas-1"))
Expand All @@ -11,10 +12,10 @@
"#65EE5C" "#5CEE8F" "#5CEECC" "#5CD3EE" "#5C96EE" "#5F5CEE" "#9C5CEE"
"#D95CEE" "#EE5CC7" "#EE5C8A" "#EE6B5C" "#EEA85C" "#EEE55C" "#BAEE5C"])

(def blank-color "#663477")
(def highlight-color "#EE5C96")
(def stroke-color "#111111")
(def text-color "#ffffff")
(def blank-color "#663477")
(def highlight-color "#EE5C96")
(def stroke-color "#111111")
(def text-color "#ffffff")
(def darker-highlight-color "#3A396C")

(defn container-color [depth] "#663477")
Expand All @@ -30,7 +31,9 @@
(doto image
(.beginPath)
(.rect x y w h)
(.fill) )))
(.fill)
;;(.strokeRect x y w h)
)))

(defn- find-color [color-lookup v] (get color-lookup v v))

Expand Down Expand Up @@ -60,7 +63,7 @@
(let [y-offset (/ (- rect-start rect-size) 2)]
(if (leaf? color)
(paint-stroked-rectangle! img color-lookup color x-offset y-offset rect-size rect-size)
(let [width (* (no-of-leaf-nodes color) (/ rect-size 2) )]
(let [width (* (no-of-leaf-nodes color) rect-size)]
(paint-stroked-rectangle! img color-lookup (container-color depth) x-offset y-offset width rect-size)))))

(defn- paint-all! [img color-lookup rect-size x-offset depth]
Expand All @@ -69,7 +72,8 @@

(if (children? color)
(let [new-rect-size (/ rect-size 2)
indent (/ new-rect-size 2)]
indent (/ (* rect-size (no-of-leaf-nodes color))
2 2)]
(+
indent
(reduce
Expand Down

0 comments on commit 6f602d1

Please sign in to comment.