           (mouseDragged [e]
                         (let [x (.getX e) y (.getY e)]
                           (swap! position-atom update-in [:x]
-                                 + (- x (:x @drag-origin)))
+                                 - (- x (:x @drag-origin)))
                           (swap! position-atom update-in [:y]
-                                 + (- y (:y @drag-origin)))
+                                 - (- y (:y @drag-origin)))
                           (reset! drag-origin {:x x :y y}))))]
     (doto component
       (.addMouseListener mouse-adapter)

                           RenderingHints/VALUE_ANTIALIAS_OFF)))))

(defn paint-tiles [^Graphics2D g available-tiles screen-state [tile-width tile-height]]
  (let [pixel-rect (Rectangle. (- (screen-state :x)) (- (screen-state :y))
                               (screen-state :width) (screen-state :height))]
    (doseq [[nx ny] (tiles-in-pixel-rectangle pixel-rect [tile-width tile-height])]
      (when-let [proc (get-in available-tiles [(screen-state :zoom) {:nx nx :ny ny :nz (screen-state :z) :nt 0 :nc 0}])]

    (proxy [JPanel] []
      (paintComponent [^Graphics graphics]
        (proxy-super paintComponent graphics)
        (paint-screen graphics @screen-state @available-tiles)))
    (.setBackground Color/BLACK)))
    
(defn main-frame []
