mirror of
https://github.com/penpot/penpot.git
synced 2025-03-12 07:41:43 -05:00
commit
946677f5b3
4 changed files with 24 additions and 6 deletions
|
@ -240,3 +240,13 @@
|
|||
(distinct)
|
||||
(filter #(not (eq % (get comp1 %) (get comp2 %))))
|
||||
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)
|
||||
objects (:objects page)
|
||||
selected (->> (wsh/lookup-selected state)
|
||||
(map #(get objects %))
|
||||
(remove #(ctk/in-component-copy-not-root? %)) ;; We don't want to change the structure of component copies
|
||||
(map (d/getf objects))
|
||||
(filter #(ctk/allow-duplicate? objects %))
|
||||
(map :id)
|
||||
set)]
|
||||
(when (seq selected)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
(:require-macros [app.main.style :as stl])
|
||||
(:require
|
||||
[app.common.colors :as cc]
|
||||
[app.common.data.macros :as dm]
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.common.math :as mth]
|
||||
[app.main.ui.workspace.colorpicker.slider-selector :refer [slider-selector]]
|
||||
|
@ -118,17 +119,24 @@
|
|||
:h new-hue
|
||||
: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/deps canvas-ref)
|
||||
(fn [] (when 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)}
|
||||
[:& slider-selector {:type :value
|
||||
:vertical? true
|
||||
:reverse? true
|
||||
:reverse? false
|
||||
:value value
|
||||
:max-value 255
|
||||
:vertical true
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
}
|
||||
|
||||
.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 {
|
||||
background: linear-gradient(
|
||||
|
|
Loading…
Add table
Reference in a new issue