mirror of
https://github.com/penpot/penpot.git
synced 2025-04-04 19:11:20 -05:00
Add path selection component when path is in edition mode.
This commit is contained in:
parent
7e7d2570d7
commit
ee9b99635b
1 changed files with 21 additions and 0 deletions
|
@ -93,6 +93,23 @@
|
|||
:style {:stroke "#333" :fill "transparent"
|
||||
:stroke-opacity "1"}}]]))
|
||||
|
||||
(mx/defc path-edition-selection-handlers
|
||||
[{:keys [id points] :as shape}]
|
||||
(letfn [(on-mouse-down [index event]
|
||||
(dom/stop-propagation event)
|
||||
(rlocks/acquire! :shape/resize)
|
||||
(println "on-mouse-down" index)
|
||||
(start-path-edition id index))
|
||||
|
||||
#_(rlocks/acquire! :shape/resize [vid id])]
|
||||
(let [tmx (geom/transformation-matrix shape)
|
||||
points (map #(gpt/transform % tmx) points)]
|
||||
[:g.controls
|
||||
(for [[index {:keys [x y]}] (map-indexed vector points)]
|
||||
[:circle {:cx x :cy y :r 3
|
||||
:on-mouse-down (partial on-mouse-down index)
|
||||
:fill "red"}])])))
|
||||
|
||||
(mx/defc single-selection-handlers
|
||||
[{:keys [id] :as shape}]
|
||||
(letfn [(on-mouse-down [vid event]
|
||||
|
@ -158,4 +175,8 @@
|
|||
(> shapes-num 1)
|
||||
(multiple-selection-handlers shapes)
|
||||
|
||||
(and (= :path (:type shape))
|
||||
(:edition? shape))
|
||||
(path-edition-selection-handlers shape)
|
||||
|
||||
(= shapes-num 1) (single-selection-handlers (first shapes)))))
|
||||
|
|
Loading…
Add table
Reference in a new issue