mirror of
https://github.com/penpot/penpot.git
synced 2026-08-07 21:38:48 +00:00
🐛 Fix CLJS bounds-map deduplication and update intersect test
In the CLJS branch of resolve-modif-tree-ids, get-parent-seq returns shape maps, but the js/Set was populated with UUIDs. As a result, .has and .add were passing full shape maps instead of their :id values, so parent deduplication never worked in ClojureScript. Fixed both .has and .add calls to extract (:id %) from the shape map. Also update the collinear-overlap test in geom-shapes-intersect-test to expect true now that the ::coplanar keyword fix (commit 847bf51) makes on-segment? collinear checks actually reachable.
This commit is contained in:
parent
b66b39735a
commit
a4647b33ee
@ -79,10 +79,10 @@
|
|||||||
(loop [new-ids
|
(loop [new-ids
|
||||||
(->> (cfh/get-parent-seq objects cid)
|
(->> (cfh/get-parent-seq objects cid)
|
||||||
(take-while #(and (cfh/group-like-shape? %)
|
(take-while #(and (cfh/group-like-shape? %)
|
||||||
(not (.has ids %))))
|
(not (.has ids (:id %)))))
|
||||||
(seq))]
|
(seq))]
|
||||||
(when (some? new-ids)
|
(when (some? new-ids)
|
||||||
(.add ids (first new-ids))
|
(.add ids (:id (first new-ids)))
|
||||||
(recur (next new-ids))))
|
(recur (next new-ids))))
|
||||||
(recur (next base-ids)))))
|
(recur (next base-ids)))))
|
||||||
ids)))
|
ids)))
|
||||||
|
|||||||
@ -52,12 +52,10 @@
|
|||||||
[(pt 0 5) (pt 10 5)]))))
|
[(pt 0 5) (pt 10 5)]))))
|
||||||
|
|
||||||
(t/testing "Two collinear overlapping segments"
|
(t/testing "Two collinear overlapping segments"
|
||||||
;; NOTE: The implementation compares orientation result (namespaced keyword ::coplanar)
|
;; Collinear overlapping segments correctly detected as intersecting.
|
||||||
;; against unnamespaced :coplanar, so the collinear branch never triggers.
|
(t/is (true? (gint/intersect-segments?
|
||||||
;; Collinear overlapping segments are NOT detected as intersecting.
|
[(pt 0 0) (pt 10 0)]
|
||||||
(t/is (false? (gint/intersect-segments?
|
[(pt 5 0) (pt 15 0)]))))
|
||||||
[(pt 0 0) (pt 10 0)]
|
|
||||||
[(pt 5 0) (pt 15 0)]))))
|
|
||||||
|
|
||||||
(t/testing "Two non-overlapping collinear segments"
|
(t/testing "Two non-overlapping collinear segments"
|
||||||
(t/is (false? (gint/intersect-segments?
|
(t/is (false? (gint/intersect-segments?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user