mirror of
https://github.com/penpot/penpot.git
synced 2025-08-03 10:38:30 +02:00
🐛 Fix incorrect handling of opacity change on gradient stop
This commit is contained in:
parent
c5b0206bf0
commit
332bbc71c3
2 changed files with 8 additions and 3 deletions
|
@ -22,7 +22,7 @@
|
|||
;; SCHEMAS & TYPES
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(def valid-color-attrs
|
||||
(def ^:private required-color-attrs
|
||||
"A set used for proper check if color should contain only one of the
|
||||
attrs listed in this set."
|
||||
#{:image :gradient :color})
|
||||
|
@ -31,7 +31,7 @@
|
|||
"Check if color has correct color attrs"
|
||||
[color]
|
||||
(let [attrs (set (keys color))
|
||||
result (set/intersection attrs valid-color-attrs)]
|
||||
result (set/intersection attrs required-color-attrs)]
|
||||
(= 1 (count result))))
|
||||
|
||||
(def ^:private hex-color-rx
|
||||
|
@ -126,6 +126,9 @@
|
|||
(sm/optional-keys schema:image-color)]
|
||||
[:fn has-valid-color-attrs?]])
|
||||
|
||||
(def color-attrs
|
||||
(into required-color-attrs (sm/keys schema:color-attrs)))
|
||||
|
||||
(def schema:library-color-attrs
|
||||
[:map {:title "ColorAttrs" :closed true}
|
||||
[:id ::sm/uuid]
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
[app.common.colors :as cc]
|
||||
[app.common.data :as d]
|
||||
[app.common.data.macros :as dm]
|
||||
[app.common.types.color :as types.color]
|
||||
[app.common.types.shape.attrs :refer [default-color]]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.data.workspace.colors :as dwc]
|
||||
|
@ -125,7 +126,8 @@
|
|||
(fn [value]
|
||||
(let [color (-> color
|
||||
(assoc :opacity (/ value 100))
|
||||
(dissoc :ref-id :ref-file))]
|
||||
(dissoc :ref-id :ref-file)
|
||||
(select-keys types.color/color-attrs))]
|
||||
(st/emit! (dwc/add-recent-color color)
|
||||
(on-change color)))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue