0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 00:58:26 -05:00

🐛 Fix unexpected bug on snap_disatches when shape is nil

Happens when you move something like svg-dev which for some
reason becomes nil on snap distances code
This commit is contained in:
Andrey Antukh 2023-09-22 09:56:21 +02:00
parent 2bd31dcbd2
commit 3ec29273d0

View file

@ -159,10 +159,13 @@
;; Left/Top shapes and right/bottom shapes (depends on `coord` parameter)
;; Gets the distance to the current selection
distances-xf (comp (map distance-to-selrect) (filter pos?))
distances-xf (comp (filter some?)
(map distance-to-selrect)
(filter pos?))
lt-distances (into #{} distances-xf lt-shapes)
gt-distances (into #{} distances-xf gt-shapes)
distances (set/union lt-distances gt-distances)
distances (set/union lt-distances gt-distances)
;; We'll show the distances that match a distance from the selrect
show-candidate? #(check-in-set % distances)