mirror of
https://github.com/penpot/penpot.git
synced 2025-06-08 04:01:41 +02:00
Fix many issues of image rendering on workspace.
This commit is contained in:
parent
658636463e
commit
7df42f3bcb
1 changed files with 5 additions and 14 deletions
|
@ -29,16 +29,17 @@
|
||||||
|
|
||||||
(defn- will-mount
|
(defn- will-mount
|
||||||
[own]
|
[own]
|
||||||
(let [{:keys [image-id]} (first (:rum/args own))]
|
(let [{:keys [image]} (first (:rum/args own))]
|
||||||
(rs/emit! (udi/fetch-image image-id))
|
(println (:rum/args own))
|
||||||
|
(rs/emit! (udi/fetch-image image))
|
||||||
own))
|
own))
|
||||||
|
|
||||||
(mx/defcs image-component
|
(mx/defcs image-component
|
||||||
{:mixins [mx/static mx/reactive]
|
{:mixins [mx/static mx/reactive]
|
||||||
:will-mount will-mount}
|
:will-mount will-mount}
|
||||||
[own {:keys [id image-id] :as shape}]
|
[own {:keys [id image] :as shape}]
|
||||||
(let [selected (mx/react common/selected-ref)
|
(let [selected (mx/react common/selected-ref)
|
||||||
image (mx/react (image-ref image-id))
|
image (mx/react (image-ref image))
|
||||||
selected? (contains? selected id)
|
selected? (contains? selected id)
|
||||||
local (:rum/local own)
|
local (:rum/local own)
|
||||||
on-mouse-down #(common/on-mouse-down % shape selected)]
|
on-mouse-down #(common/on-mouse-down % shape selected)]
|
||||||
|
@ -61,13 +62,3 @@
|
||||||
attrs (-> (attrs/extract-style-attrs shape)
|
attrs (-> (attrs/extract-style-attrs shape)
|
||||||
(merge props size))]
|
(merge props size))]
|
||||||
[:image attrs]))
|
[: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]))
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue