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:
parent
cc83a9b099
commit
eb19d5f90a
1 changed files with 18 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue