🐛 Fix unexpected exception on selectiong node on non path shape

This commit is contained in:
Andrey Antukh 2025-06-18 10:02:44 +02:00
parent 5d72954611
commit e3cce104e1
2 changed files with 20 additions and 17 deletions

View file

@ -474,6 +474,8 @@
"Given a content and a set of points return all the segments in the path "Given a content and a set of points return all the segments in the path
that uses the points" that uses the points"
[content points] [content points]
(assert (impl/path-data? content) "expected path data instance")
(let [point-set (set points)] (let [point-set (set points)]
(loop [result (transient []) (loop [result (transient [])
prev-point nil prev-point nil

View file

@ -46,6 +46,7 @@
(i/icon-xref :snap-nodes (stl/css :snap-nodes-icon :pathbar-icon))) (i/icon-xref :snap-nodes (stl/css :snap-nodes-icon :pathbar-icon)))
(defn check-enabled [content selected-points] (defn check-enabled [content selected-points]
(when content
(let [segments (path.segm/get-segments-with-points content selected-points) (let [segments (path.segm/get-segments-with-points content selected-points)
num-segments (count segments) num-segments (count segments)
num-points (count selected-points) num-points (count selected-points)
@ -63,7 +64,7 @@
:remove-node points-selected? :remove-node points-selected?
:merge-nodes segments-selected? :merge-nodes segments-selected?
:join-nodes (and points-selected? (>= num-points 2) (< num-segments max-segments)) :join-nodes (and points-selected? (>= num-points 2) (< num-segments max-segments))
:separate-nodes segments-selected?})) :separate-nodes segments-selected?})))
(mf/defc path-actions* (mf/defc path-actions*
[{:keys [shape edit-path]}] [{:keys [shape edit-path]}]