0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 07:29:08 -05:00

Merge pull request #3861 from penpot/superalex-fix-disable-images-for-selected-colors

🐛 Disable images for selected colors
This commit is contained in:
Alejandro 2023-11-28 10:30:03 +01:00 committed by GitHub
commit 9a5234737e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,21 +27,21 @@
color-id (:fill-color-ref-id fill) color-id (:fill-color-ref-id fill)
shared-libs-colors (dm/get-in shared-libs [color-file-id :data :colors]) shared-libs-colors (dm/get-in shared-libs [color-file-id :data :colors])
is-shared? (contains? shared-libs-colors color-id) is-shared? (contains? shared-libs-colors color-id)
has-color? (or (not (nil? (:fill-color fill))) (not (nil? (:fill-color-gradient fill))))
attrs (if (or is-shared? (= color-file-id file-id)) attrs (if (or is-shared? (= color-file-id file-id))
(d/without-nils {:color (str/lower (:fill-color fill)) (d/without-nils {:color (str/lower (:fill-color fill))
:opacity (:fill-opacity fill) :opacity (:fill-opacity fill)
:id color-id :id color-id
:file-id color-file-id :file-id color-file-id
:gradient (:fill-color-gradient fill) :gradient (:fill-color-gradient fill)})
:image (:fill-image fill)})
(d/without-nils {:color (str/lower (:fill-color fill)) (d/without-nils {:color (str/lower (:fill-color fill))
:opacity (:fill-opacity fill) :opacity (:fill-opacity fill)
:gradient (:fill-color-gradient fill) :gradient (:fill-color-gradient fill)}))]
:image (:fill-image fill)}))] (when has-color?
{:attrs attrs {:attrs attrs
:prop :fill :prop :fill
:shape-id (:shape-id fill) :shape-id (:shape-id fill)
:index (:index fill)})) :index (:index fill)})))
(defn stroke->color-att (defn stroke->color-att
[stroke file-id shared-libs] [stroke file-id shared-libs]
@ -49,18 +49,16 @@
color-id (:stroke-color-ref-id stroke) color-id (:stroke-color-ref-id stroke)
shared-libs-colors (dm/get-in shared-libs [color-file-id :data :colors]) shared-libs-colors (dm/get-in shared-libs [color-file-id :data :colors])
is-shared? (contains? shared-libs-colors color-id) is-shared? (contains? shared-libs-colors color-id)
has-color? (or (not (nil? (:stroke-color stroke))) (not (nil? (:stroke-image stroke))) ) has-color? (or (not (nil? (:stroke-color stroke))) (not (nil? (:stroke-color-gradient stroke))))
attrs (if (or is-shared? (= color-file-id file-id)) attrs (if (or is-shared? (= color-file-id file-id))
(d/without-nils {:color (str/lower (:stroke-color stroke)) (d/without-nils {:color (str/lower (:stroke-color stroke))
:opacity (:stroke-opacity stroke) :opacity (:stroke-opacity stroke)
:id color-id :id color-id
:file-id color-file-id :file-id color-file-id
:gradient (:stroke-color-gradient stroke) :gradient (:stroke-color-gradient stroke)})
:image (:stroke-image stroke)})
(d/without-nils {:color (str/lower (:stroke-color stroke)) (d/without-nils {:color (str/lower (:stroke-color stroke))
:opacity (:stroke-opacity stroke) :opacity (:stroke-opacity stroke)
:gradient (:stroke-color-gradient stroke) :gradient (:stroke-color-gradient stroke)}))]
:image (:stroke-image stroke)}))]
(when has-color? (when has-color?
{:attrs attrs {:attrs attrs
:prop :stroke :prop :stroke