0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-25 07:58:49 -05:00

Allows change colors from root

This commit is contained in:
alonso.torres 2021-01-12 12:31:42 +01:00 committed by Alonso Torres
parent 5f0020a95c
commit b999c05d1e
3 changed files with 18 additions and 28 deletions

View file

@ -112,9 +112,6 @@
(let [pid (:current-page-id state)
objects (get-in state [:workspace-data :pages-index pid :objects])
not-frame (fn [shape-id] (not= (get-in objects [shape-id :type]) :frame))
children (->> ids (filter not-frame) (mapcat #(cp/get-children % objects)))
ids (into ids children)
is-text? #(= :text (:type (get objects %)))
text-ids (filter is-text? ids)
shape-ids (filter (comp not is-text?) ids)
@ -141,9 +138,6 @@
(let [pid (:current-page-id state)
objects (get-in state [:workspace-data :pages-index pid :objects])
not-frame (fn [shape-id] (not= (get-in objects [shape-id :type]) :frame))
children (->> ids (filter not-frame) (mapcat #(cp/get-children % objects)))
ids (into ids children)
update-fn (fn [s]
(cond-> s
true

View file

@ -226,20 +226,20 @@
objects (dwc/lookup-page-objects state page-id)
find-shape
(fn [selection]
(when (seq selection)
(let [id (first selection)
shape (get objects id)]
(let [child-id (->> (cp/get-children id objects)
(map #(get objects %))
(remove (comp empty :shapes))
(filter #(geom/has-point? % position))
(first)
:id)]
(or child-id id)))))]
(let [id (first selection)
shape (get objects id)]
(let [child-id (->> (cp/get-children id objects)
(map #(get objects %))
(remove (comp empty :shapes))
(filter #(geom/has-point? % position))
(first)
:id)]
(or child-id id))))]
(->> (uw/ask! {:cmd :selection/query
:page-id page-id
:rect (geom/make-centered-rect position 1 1)})
(rx/first)
(rx/filter (comp not empty?))
(rx/map find-shape)
(rx/filter #(not (nil? %)))
(rx/map #(select-shape % false))))))))

View file

@ -95,22 +95,18 @@
(when (contains? svg-elements tag)
[:*
(cond
(= tag :svg)
(when (= tag :svg)
[:*
[:& measures-menu {:ids ids
:type type
:values measure-values}]]
:else
[:*
[:& fill-menu {:ids ids
:type type
:values fill-values}]
[:& stroke-menu {:ids ids
:type type
:values stroke-values}]])
:values measure-values}]])
[:& fill-menu {:ids ids
:type type
:values fill-values}]
[:& stroke-menu {:ids ids
:type type
:values stroke-values}]
[:& shadow-menu {:ids ids
:values (select-keys shape [:shadow])}]