0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-12 07:41:43 -05:00

Merge pull request #4257 from penpot/alotor-bugfixes-27

Bugfixes
This commit is contained in:
Alejandro 2024-03-13 07:11:38 +01:00 committed by GitHub
commit 946677f5b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 6 deletions

View file

@ -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))))))

View file

@ -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)

View file

@ -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

View file

@ -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(