   (let [[rx ry] (cameras/screen->point (:camera state) x y)
         ;; TODO: better way to get selected layers
         db @(:db state)
-        layers (map #(ds/touch+ (d/entity db %)) layer-eids)
+        layers (mapv #(ds/touch+ (d/entity db %)) layer-eids)
         [group-id & entity-ids :as used-ids] (take (inc (count layers)) (:entity-ids state))
         group-layer (assoc (ds/touch+ (d/entity db group-eid))
                       :layer/child (set entity-ids)

        [snap-move-x snap-move-y] (cameras/snap-to-grid (:camera state) move-x move-y)
        layers (get-in state [:drawing :layers])
        snap-paths? (first (filter #(not= :layer.type/path (:layer/type %)) layers))
        layers (map (fn [layer original]
                      (move-layer layer original {:snap-x snap-move-x :snap-y snap-move-y :x move-x :y move-y :snap-paths? snap-paths?}))
                    layers
                    (get-in state [:drawing :original-layers]))]
    (assoc-in state [:drawing :layers] layers)))

(defmethod control-event :mouse-moved

  [browser-state message {:keys [group-eid layer-eids x y]} state]
  (let [[rx ry] (cameras/screen->point (:camera state) x y)
        db @(:db state)
        layers (mapv #(ds/touch+ (d/entity db %)) layer-eids)]
    (-> state
        (assoc :selected-eid group-eid)
        ;; TODO: maybe we should always deal with layers?
        (assoc-in [:drawing :layers] (mapv (fn [layer]
                                             (assoc layer
                                               :layer/current-x (:layer/end-x layer)
                                               :layer/current-y (:layer/end-y layer)
                                               :points (when (:layer/path layer) (parse-points-from-path (:layer/path layer)))))
                                           layers))
        (assoc-in [:drawing :original-layers] layers)
        (assoc-in [:drawing :moving?] true)
        (assoc-in [:drawing :starting-mouse-position] [rx ry]))))
