From 3ec29273d012aa3ecdd2180ece8309ba20252c0c Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 22 Sep 2023 09:56:21 +0200 Subject: [PATCH] :bug: 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 --- .../src/app/main/ui/workspace/viewport/snap_distances.cljs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/viewport/snap_distances.cljs b/frontend/src/app/main/ui/workspace/viewport/snap_distances.cljs index b7530466c..d37930839 100644 --- a/frontend/src/app/main/ui/workspace/viewport/snap_distances.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/snap_distances.cljs @@ -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)