mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 09:08:31 -05:00
❗ fixed issue when drawing images from workspace
This commit is contained in:
parent
1869e2b160
commit
1b8aab654f
1 changed files with 26 additions and 13 deletions
|
@ -82,20 +82,33 @@
|
||||||
[:div.library-tab-content
|
[:div.library-tab-content
|
||||||
(let [items (mf/deref (selected-items-ref section current-selection))]
|
(let [items (mf/deref (selected-items-ref section current-selection))]
|
||||||
(for [item items]
|
(for [item items]
|
||||||
[:div.library-tab-element
|
(if (= section :icons)
|
||||||
{:key (:id item)
|
;; ICONS
|
||||||
:on-click #(st/emit! (dw/select-for-drawing :icon item))}
|
[:div.library-tab-element
|
||||||
(if (= section :icons)
|
{:key (str "icon-" (:id item))
|
||||||
[:* ;; ICONS
|
:on-click #(st/emit! (dw/select-for-drawing :icon item))}
|
||||||
[:svg {:view-box (->> item :metadata :view-box (str/join " "))
|
|
||||||
:width (-> item :metadata :width)
|
|
||||||
:height (-> item :metadat :height)
|
|
||||||
:dangerouslySetInnerHTML {:__html (:content item)}}]
|
|
||||||
[:span.library-tab-element-name (:name item)]]
|
|
||||||
|
|
||||||
[:* ;; IMAGES
|
[:svg {:view-box (->> item :metadata :view-box (str/join " "))
|
||||||
[:img {:src (:thumb-uri item)}]
|
:width (-> item :metadata :width)
|
||||||
[:span.library-tab-element-name (:name item)]])]))]])))
|
:height (-> item :metadat :height)
|
||||||
|
:dangerouslySetInnerHTML {:__html (:content item)}}]
|
||||||
|
[:span.library-tab-element-name (:name item)]]
|
||||||
|
|
||||||
|
;; IMAGES
|
||||||
|
[:div.library-tab-element
|
||||||
|
{:key (str "image-" (:id item))
|
||||||
|
:on-click #(let [shape {:name name
|
||||||
|
:metadata {:width (:width item)
|
||||||
|
:height (:height item)
|
||||||
|
:uri (:uri item)
|
||||||
|
:thumb-width (:thumb-width item)
|
||||||
|
:thumb-height (:thumb-height item)
|
||||||
|
:thumb-uri (:thumb-uri item)}}]
|
||||||
|
(st/emit! (dw/select-for-drawing :image shape)))}
|
||||||
|
|
||||||
|
[:img {:src (:thumb-uri item)}]
|
||||||
|
[:span.library-tab-element-name (:name item)]])
|
||||||
|
))]])))
|
||||||
|
|
||||||
(mf/defc libraries-toolbox
|
(mf/defc libraries-toolbox
|
||||||
[{:keys [key]}]
|
[{:keys [key]}]
|
||||||
|
|
Loading…
Add table
Reference in a new issue