mirror of
https://github.com/penpot/penpot.git
synced 2025-05-10 18:46:37 +02:00
Merge pull request #1815 from penpot/superalex-bullet-colors-from-pasted-shapes-with-library-colors
🐛 Fix bullet colors from pasted shapes with library colors
This commit is contained in:
commit
b2d13f277a
1 changed files with 11 additions and 8 deletions
|
@ -65,11 +65,11 @@
|
||||||
shared-libs (mf/deref refs/workspace-libraries)
|
shared-libs (mf/deref refs/workspace-libraries)
|
||||||
hover-detach (mf/use-state false)
|
hover-detach (mf/use-state false)
|
||||||
|
|
||||||
get-color-name (fn [{:keys [id file-id]}]
|
src-colors (if (= (:file-id color) current-file-id)
|
||||||
(let [src-colors (if (= file-id current-file-id)
|
|
||||||
file-colors
|
file-colors
|
||||||
(get-in shared-libs [file-id :data :colors]))]
|
(get-in shared-libs [(:file-id color) :data :colors]))
|
||||||
(get-in src-colors [id :name])))
|
|
||||||
|
color-name (get-in src-colors [(:id color) :name])
|
||||||
|
|
||||||
parse-color (fn [color]
|
parse-color (fn [color]
|
||||||
(-> color
|
(-> color
|
||||||
|
@ -141,15 +141,18 @@
|
||||||
:dnd-over-top (= (:over dprops) :top)
|
:dnd-over-top (= (:over dprops) :top)
|
||||||
:dnd-over-bot (= (:over dprops) :bot))
|
:dnd-over-bot (= (:over dprops) :bot))
|
||||||
:ref dref}
|
:ref dref}
|
||||||
[:& cb/color-bullet {:color color
|
[:& cb/color-bullet {:color (cond-> color
|
||||||
|
(nil? color-name) (assoc
|
||||||
|
:id nil
|
||||||
|
:file-id nil))
|
||||||
:on-click handle-click-color}]
|
:on-click handle-click-color}]
|
||||||
|
|
||||||
(cond
|
(cond
|
||||||
;; Rendering a color with ID
|
;; Rendering a color with ID
|
||||||
(and (:id color) (not (uc/multiple? color)))
|
(and (:id color) color-name (not (uc/multiple? color)))
|
||||||
[:*
|
[:*
|
||||||
[:div.color-info
|
[:div.color-info
|
||||||
[:div.color-name (str (get-color-name color))]]
|
[:div.color-name (str color-name)]]
|
||||||
(when on-detach
|
(when on-detach
|
||||||
[:div.element-set-actions-button
|
[:div.element-set-actions-button
|
||||||
{:on-mouse-enter #(reset! hover-detach true)
|
{:on-mouse-enter #(reset! hover-detach true)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue