mirror of
https://github.com/penpot/penpot.git
synced 2025-03-12 15:51:37 -05:00
commit
946677f5b3
4 changed files with 24 additions and 6 deletions
|
@ -240,3 +240,13 @@
|
||||||
(distinct)
|
(distinct)
|
||||||
(filter #(not (eq % (get comp1 %) (get comp2 %))))
|
(filter #(not (eq % (get comp1 %) (get comp2 %))))
|
||||||
set)))
|
set)))
|
||||||
|
|
||||||
|
(defn allow-duplicate?
|
||||||
|
[objects shape]
|
||||||
|
|
||||||
|
(let [parent (get objects (:parent-id shape))]
|
||||||
|
;; We don't want to change the structure of component copies
|
||||||
|
(and (not (in-component-copy-not-head? shape))
|
||||||
|
;; Non instance, non copy. We allow
|
||||||
|
(or (not (instance-head? shape))
|
||||||
|
(not (in-component-copy? parent))))))
|
||||||
|
|
|
@ -709,8 +709,8 @@
|
||||||
(let [page (wsh/lookup-page state)
|
(let [page (wsh/lookup-page state)
|
||||||
objects (:objects page)
|
objects (:objects page)
|
||||||
selected (->> (wsh/lookup-selected state)
|
selected (->> (wsh/lookup-selected state)
|
||||||
(map #(get objects %))
|
(map (d/getf objects))
|
||||||
(remove #(ctk/in-component-copy-not-root? %)) ;; We don't want to change the structure of component copies
|
(filter #(ctk/allow-duplicate? objects %))
|
||||||
(map :id)
|
(map :id)
|
||||||
set)]
|
set)]
|
||||||
(when (seq selected)
|
(when (seq selected)
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
(:require-macros [app.main.style :as stl])
|
(:require-macros [app.main.style :as stl])
|
||||||
(:require
|
(:require
|
||||||
[app.common.colors :as cc]
|
[app.common.colors :as cc]
|
||||||
|
[app.common.data.macros :as dm]
|
||||||
[app.common.geom.point :as gpt]
|
[app.common.geom.point :as gpt]
|
||||||
[app.common.math :as mth]
|
[app.common.math :as mth]
|
||||||
[app.main.ui.workspace.colorpicker.slider-selector :refer [slider-selector]]
|
[app.main.ui.workspace.colorpicker.slider-selector :refer [slider-selector]]
|
||||||
|
@ -118,17 +119,24 @@
|
||||||
:h new-hue
|
:h new-hue
|
||||||
:s saturation})))
|
:s saturation})))
|
||||||
|
|
||||||
on-change-opacity (fn [new-alpha] (on-change {:alpha new-alpha}))]
|
on-change-opacity (fn [new-alpha] (on-change {:alpha new-alpha}))
|
||||||
|
|
||||||
|
;; This colors are to display the value slider
|
||||||
|
[h1 s1 l1] (cc/hsv->hsl [hue saturation 0])
|
||||||
|
[h2 s2 l2] (cc/hsv->hsl [hue saturation 255])]
|
||||||
|
|
||||||
(mf/use-effect
|
(mf/use-effect
|
||||||
(mf/deps canvas-ref)
|
(mf/deps canvas-ref)
|
||||||
(fn [] (when canvas-ref
|
(fn [] (when canvas-ref
|
||||||
(create-color-wheel (mf/ref-val canvas-ref)))))
|
(create-color-wheel (mf/ref-val canvas-ref)))))
|
||||||
[:div {:class (stl/css :harmony-selector)}
|
|
||||||
|
[:div {:class (stl/css :harmony-selector)
|
||||||
|
:style {"--hue-from" (dm/str "hsl(" h1 ", " (* s1 100) "%, " (* l1 100) "%)")
|
||||||
|
"--hue-to" (dm/str "hsl(" h2 ", " (* s2 100) "%, " (* l2 100) "%)")}}
|
||||||
[:div {:class (stl/css :handlers-wrapper)}
|
[:div {:class (stl/css :handlers-wrapper)}
|
||||||
[:& slider-selector {:type :value
|
[:& slider-selector {:type :value
|
||||||
:vertical? true
|
:vertical? true
|
||||||
:reverse? true
|
:reverse? false
|
||||||
:value value
|
:value value
|
||||||
:max-value 255
|
:max-value 255
|
||||||
:vertical true
|
:vertical true
|
||||||
|
|
|
@ -107,7 +107,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.slider-selector.value {
|
.slider-selector.value {
|
||||||
background: linear-gradient(var(--gradient-direction), #000 0%, #fff 100%);
|
background: linear-gradient(var(--gradient-direction), var(--hue-from, #000) 0%, var(--hue-to, #fff) 100%);
|
||||||
}
|
}
|
||||||
.slider-selector.saturation {
|
.slider-selector.saturation {
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
|
|
Loading…
Add table
Reference in a new issue