0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-03 12:59:12 -05:00

Fix many issues of image rendering on workspace.

This commit is contained in:
Andrey Antukh 2016-10-24 22:20:08 +02:00
parent 658636463e
commit 7df42f3bcb
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -29,16 +29,17 @@
(defn- will-mount
[own]
(let [{:keys [image-id]} (first (:rum/args own))]
(rs/emit! (udi/fetch-image image-id))
(let [{:keys [image]} (first (:rum/args own))]
(println (:rum/args own))
(rs/emit! (udi/fetch-image image))
own))
(mx/defcs image-component
{:mixins [mx/static mx/reactive]
:will-mount will-mount}
[own {:keys [id image-id] :as shape}]
[own {:keys [id image] :as shape}]
(let [selected (mx/react common/selected-ref)
image (mx/react (image-ref image-id))
image (mx/react (image-ref image))
selected? (contains? selected id)
local (:rum/local own)
on-mouse-down #(common/on-mouse-down % shape selected)]
@ -61,13 +62,3 @@
attrs (-> (attrs/extract-style-attrs shape)
(merge props size))]
[:image attrs]))
;; --- Image SVG
(mx/defc image-svg
{:mixins [mx/static]}
[{:keys [data id view-box] :as shape}]
(let [key (str "image-svg-" id)
view-box (apply str (interpose " " view-box))
props {:view-box view-box :id key :key key}]
[:svg props data]))