 
 (defn- on-press-drag
   [state e]
-  (let [
-        x-cell        (int (/ (.getX e) (/ (.getWidth (.getComponent e)) (:num-steps state))))
-        y-cell        (int (/ (.getY e) (/ (.getHeight (.getComponent e)) 2)))
-        tick-height  (/ (.getHeight (.getComponent e)) NUM_SLICES)
-        current-value (- (int (/ (.getY e) tick-height)) 10)]
+  (let [x (.getX e)
+        y (.getY e)
+        x-cell        (quot x (quot (width e) (:num-steps state)))
+        y-cell        (quot y (quot (height e) 2))
+        tick-height   (quot (height e) (:num-slices state))
+        current-value (- (quot y tick-height) (quot (:num-slices state) 2))]
     (assoc (assoc-in state [:steps x-cell] current-value)
            :current-value current-value)))
 

                   (dseq (map #(+ 60 %) (:steps @(:state pstep)))))
        src (saw (midicps note))]
    (* [0.2 0.2] src)))
)

        x-res         (:num-steps state)
        step-width    (/ w (:num-steps state))
        y             (/ h 2)
        tick-height   (/ h (:num-slices state))
        num-steps    (:num-steps state)
        line-padding  0]

    (draw g (rect 0 0 w h) background-fill)

    (dotimes [i (:num-slices state)]
      (draw g (line 0 (* i tick-height) w (* i tick-height)) background-stroke))

    (dotimes [i num-steps]
