                               :pos-x (+ (@state :pos-x-start)
                                         (- (@state :touch-x)
                                            (@state :touch-x-start)))))
+
+        set-panel-count! (fn [panel-count]
+                           (swap! state assoc :panel-count panel-count))
 
         get-dragging? (fn []
                         (reaction (@state :dragging?)))

                     (let [x (.-clientX (aget (.-changedTouches e) 0))
                           dragging? (get-dragging?)]
                       (when @dragging?
                         (drag-end!))))
        ]
    (r/create-class
      {
       :component-did-mount
       (fn []
         (.addEventListener js/document "touchstart" touch-start!)
         (.addEventListener js/document "touchmove" touch-move!)
         (.addEventListener js/document "touchend" touch-end!))
       :component-will-unmount
       (fn []
         (.removeEventListener js/document "touchstart" touch-start!)

                                  (-> x
                                      (min xmax)
                                      (max xmin)))
                          max-n (dec (@state :panel-count))
                          new-n (bound (+ pos-n delta-n) 0 max-n)
                          snap-x (- (* w new-n))]

