0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -05:00

Draw image with original size instead with a fixed one.

This commit is contained in:
Andrey Antukh 2017-03-21 11:27:17 +01:00
parent cc83a9b099
commit eb19d5f90a
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -225,6 +225,7 @@
(gpt/divide @refs/selected-zoom)))
(declare on-init-draw-icon)
(declare on-init-draw-image)
(declare on-init-draw-path)
(declare on-init-draw-free-path)
(declare on-init-draw-generic)
@ -238,7 +239,7 @@
(rx/take 1))]
(case (:type shape)
:icon (on-init-draw-icon shape)
:image (on-init-draw-icon shape)
:image (on-init-draw-image shape)
:path (if (:free shape)
(on-init-draw-free-path shape stoper)
(on-init-draw-path shape stoper))
@ -285,6 +286,22 @@
(select-for-drawing nil)
::uev/interrupt)))
(defn- on-init-draw-image
[{:keys [metadata] :as shape}]
(let [{:keys [x y]} (gpt/divide @refs/canvas-mouse-position
@refs/selected-zoom)
{:keys [width height]} metadata
proportion (/ width height)
props {:x1 x
:y1 y
:x2 (+ x width)
:y2 (+ y height)}
shape (geom/setup shape props)]
(st/emit! (uds/add-shape shape)
(uds/select-first-shape)
(select-for-drawing nil)
::uev/interrupt)))
(def ^:private immanted-zones
(let [transform #(vector (- % 7) (+ % 7) %)]
(concat