mirror of
https://github.com/penpot/penpot.git
synced 2025-06-01 20:11:42 +02:00
🐛 Fix selection bug on path edition
This commit is contained in:
parent
233b9a7951
commit
ee7c3ece75
1 changed files with 17 additions and 9 deletions
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
(ns app.main.data.workspace.path.selection
|
(ns app.main.data.workspace.path.selection
|
||||||
(:require
|
(:require
|
||||||
|
[app.common.data.macros :as dm]
|
||||||
[app.common.geom.point :as gpt]
|
[app.common.geom.point :as gpt]
|
||||||
[app.common.geom.rect :as grc]
|
[app.common.geom.rect :as grc]
|
||||||
[app.common.geom.shapes :as gsh]
|
[app.common.geom.shapes :as gsh]
|
||||||
|
@ -43,20 +44,27 @@
|
||||||
(let [id (st/get-path-id state)]
|
(let [id (st/get-path-id state)]
|
||||||
(update-in state [:workspace-local :edit-path id :hover-handlers] disj [index prefix])))))
|
(update-in state [:workspace-local :edit-path id :hover-handlers] disj [index prefix])))))
|
||||||
|
|
||||||
(defn select-node-area [shift?]
|
(defn select-node-area
|
||||||
|
[shift?]
|
||||||
(ptk/reify ::select-node-area
|
(ptk/reify ::select-node-area
|
||||||
ptk/UpdateEvent
|
ptk/UpdateEvent
|
||||||
(update [_ state]
|
(update [_ state]
|
||||||
(let [selrect (get-in state [:workspace-local :selrect])
|
(let [selrect (dm/get-in state [:workspace-local :selrect])
|
||||||
id (get-in state [:workspace-local :edition])
|
id (dm/get-in state [:workspace-local :edition])
|
||||||
content (st/get-path state :content)
|
content (st/get-path state :content)
|
||||||
selected-point? #(gsh/has-point-rect? selrect %)
|
|
||||||
selected-points (or (get-in state [:workspace-local :edit-path id :selected-points]) #{})
|
selected-point? (if (some? selrect)
|
||||||
positions (into (if shift? selected-points #{})
|
(partial gsh/has-point-rect? selrect)
|
||||||
(comp (filter #(not (= (:command %) :close-path)))
|
(constantly false))
|
||||||
|
|
||||||
|
selected-points (dm/get-in state [:workspace-local :edit-path id :selected-points])
|
||||||
|
selected-points (or selected-points #{})
|
||||||
|
|
||||||
|
xform (comp (filter #(not (= (:command %) :close-path)))
|
||||||
(map (comp gpt/point :params))
|
(map (comp gpt/point :params))
|
||||||
(filter selected-point?))
|
(filter selected-point?))
|
||||||
content)]
|
positions (into (if shift? selected-points #{}) xform content)]
|
||||||
|
|
||||||
(cond-> state
|
(cond-> state
|
||||||
(some? id)
|
(some? id)
|
||||||
(assoc-in [:workspace-local :edit-path id :selected-points] positions))))))
|
(assoc-in [:workspace-local :edit-path id :selected-points] positions))))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue