mirror of
https://github.com/penpot/penpot.git
synced 2025-03-13 00:01:51 -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.main.data.workspace.common :as dwc]
|
||||
[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)
|
||||
|
||||
|
@ -169,8 +170,11 @@
|
|||
(ptk/reify ::change-fill-selected
|
||||
ptk/WatchEvent
|
||||
(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)
|
||||
|
||||
is-text? #(= :text (:type (get objects %)))
|
||||
text-ids (filter is-text? ids)
|
||||
shape-ids (filter (comp not is-text?) ids)
|
||||
|
@ -188,7 +192,11 @@
|
|||
(ptk/reify ::change-stroke-selected
|
||||
ptk/WatchEvent
|
||||
(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]
|
||||
(cond-> s
|
||||
true
|
||||
|
|
|
@ -227,17 +227,17 @@
|
|||
(mf/deps props fetch-pending)
|
||||
(fn []
|
||||
(try
|
||||
(timers/schedule
|
||||
#(let [svg-node (mf/ref-val svg-ref)
|
||||
canvas-node (mf/ref-val canvas-ref)
|
||||
canvas-context (.getContext canvas-node "2d")
|
||||
xml (.serializeToString (js/XMLSerializer.) svg-node)
|
||||
content (str "data:image/svg+xml;base64," (js/btoa xml))
|
||||
img (js/Image.)]
|
||||
(obj/set! img "onload"
|
||||
(fn []
|
||||
(.drawImage canvas-context img 0 0)))
|
||||
(obj/set! img "src" content)))
|
||||
(let [canvas-node (mf/ref-val canvas-ref)
|
||||
canvas-context (.getContext canvas-node "2d")
|
||||
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))
|
||||
img (js/Image.)]
|
||||
(obj/set! img "onload"
|
||||
(fn []
|
||||
(.drawImage canvas-context img 0 0)))
|
||||
(obj/set! img "src" content))))
|
||||
(catch :default e (.error js/console e)))))
|
||||
|
||||
[:*
|
||||
|
|
Loading…
Add table
Reference in a new issue