mirror of
https://github.com/penpot/penpot.git
synced 2025-03-13 08:11:30 -05:00
✨ Fixes picker for groups
This commit is contained in:
parent
3a4ef73f06
commit
0b4887ed96
2 changed files with 22 additions and 14 deletions
|
@ -22,7 +22,8 @@
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.main.data.workspace.common :as dwc]
|
[app.main.data.workspace.common :as dwc]
|
||||||
[app.main.data.workspace.texts :as dwt]
|
[app.main.data.workspace.texts :as dwt]
|
||||||
[app.main.data.modal :as md]))
|
[app.main.data.modal :as md]
|
||||||
|
[app.common.pages-helpers :as cph]))
|
||||||
|
|
||||||
(declare create-color-result)
|
(declare create-color-result)
|
||||||
|
|
||||||
|
@ -169,8 +170,11 @@
|
||||||
(ptk/reify ::change-fill-selected
|
(ptk/reify ::change-fill-selected
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state s]
|
(watch [_ state s]
|
||||||
(let [ids (get-in state [:workspace-local :selected])
|
(let [selected (get-in state [:workspace-local :selected])
|
||||||
objects (get-in state [:workspace-data :pages-index (:current-page-id state) :objects])
|
objects (get-in state [:workspace-data :pages-index (:current-page-id state) :objects])
|
||||||
|
children (mapcat #(cph/get-children % objects) selected)
|
||||||
|
ids (into selected children)
|
||||||
|
|
||||||
is-text? #(= :text (:type (get objects %)))
|
is-text? #(= :text (:type (get objects %)))
|
||||||
text-ids (filter is-text? ids)
|
text-ids (filter is-text? ids)
|
||||||
shape-ids (filter (comp not is-text?) ids)
|
shape-ids (filter (comp not is-text?) ids)
|
||||||
|
@ -188,7 +192,11 @@
|
||||||
(ptk/reify ::change-stroke-selected
|
(ptk/reify ::change-stroke-selected
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state s]
|
(watch [_ state s]
|
||||||
(let [ids (get-in state [:workspace-local :selected])
|
(let [selected (get-in state [:workspace-local :selected])
|
||||||
|
objects (get-in state [:workspace-data :pages-index (:current-page-id state) :objects])
|
||||||
|
children (mapcat #(cph/get-children % objects) selected)
|
||||||
|
ids (into selected children)
|
||||||
|
|
||||||
update-fn (fn [s]
|
update-fn (fn [s]
|
||||||
(cond-> s
|
(cond-> s
|
||||||
true
|
true
|
||||||
|
|
|
@ -227,17 +227,17 @@
|
||||||
(mf/deps props fetch-pending)
|
(mf/deps props fetch-pending)
|
||||||
(fn []
|
(fn []
|
||||||
(try
|
(try
|
||||||
(timers/schedule
|
(let [canvas-node (mf/ref-val canvas-ref)
|
||||||
#(let [svg-node (mf/ref-val svg-ref)
|
|
||||||
canvas-node (mf/ref-val canvas-ref)
|
|
||||||
canvas-context (.getContext canvas-node "2d")
|
canvas-context (.getContext canvas-node "2d")
|
||||||
xml (.serializeToString (js/XMLSerializer.) svg-node)
|
svg-node (mf/ref-val svg-ref)]
|
||||||
|
(timers/schedule
|
||||||
|
#(let [xml (.serializeToString (js/XMLSerializer.) svg-node)
|
||||||
content (str "data:image/svg+xml;base64," (js/btoa xml))
|
content (str "data:image/svg+xml;base64," (js/btoa xml))
|
||||||
img (js/Image.)]
|
img (js/Image.)]
|
||||||
(obj/set! img "onload"
|
(obj/set! img "onload"
|
||||||
(fn []
|
(fn []
|
||||||
(.drawImage canvas-context img 0 0)))
|
(.drawImage canvas-context img 0 0)))
|
||||||
(obj/set! img "src" content)))
|
(obj/set! img "src" content))))
|
||||||
(catch :default e (.error js/console e)))))
|
(catch :default e (.error js/console e)))))
|
||||||
|
|
||||||
[:*
|
[:*
|
||||||
|
|
Loading…
Add table
Reference in a new issue