   (let [clipboard-image (om/get-state owner :clipboard-image)
         paste-rect [0 0 (:width clipboard-image) (:height clipboard-image)]]
     (om/set-state! owner :selection-image clipboard-image)
-    (om/set-state! owner :selection paste-rect)))
+    (om/set-state! owner :selection paste-rect)
+    (om/set-state! owner :selection-was-pasted true)))
 
 (defn handle-command [app owner e]
   (when (= e :copy) (copy app owner e))

         (* (- adjusted-doc-y mouse-down-y) zoom-factor))))

  (when (= paint-tool :selection)
    (let [user-is-moving-selection (om/get-state owner :user-is-moving-selection)]
      (when (not user-is-moving-selection)
        (clear-preview-canvas)
        (set! (.-fillStyle preview-context) "rgba(127,127,127,0.3)")

  (om/set-state! owner :selection [0 0 0 0])
  (om/set-state! owner :mouse-offset-in-selection [0 0])
  (om/set-state! owner :selection-image {})
  (om/set-state! owner :user-is-moving-selection false)
  (om/set-state! owner :selection-was-pasted false))


(defn make-selection [app owner doc-x doc-y doc-width]
  (let [[orig-x orig-y] (get-in @guistate/transient-state [:mouse-down-pos])
        selection-rect (geometry/normalize-rect orig-x orig-y doc-x doc-y)
        main-image (canvas/get-current-pixels @app)]
    (clear-selection-state owner)
    (om/set-state! owner :selection selection-rect)
    (om/set-state! owner :selection-image (clip-sub-image main-image selection-rect doc-width))))

