From 587492236762821fa8c4df061888e8e9f3fd86ed Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 23 Mar 2023 17:13:04 +0100 Subject: [PATCH] :bug: Fix problem with guides not showing when moving over nested frames --- CHANGES.md | 1 + frontend/src/app/main/ui/workspace/viewport.cljs | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 215aca9aa..111d5b9a5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -51,6 +51,7 @@ - Fix visual problem in select options [Taiga #5028](https://tree.taiga.io/project/penpot/issue/5028) - Forbid empty names for assets [Taiga #5056](https://tree.taiga.io/project/penpot/issue/5056) - Select children after ungroup action [Taiga #4917](https://tree.taiga.io/project/penpot/issue/4917) +- Fix problem with guides not showing when moving over nested frames [Taiga #4905](https://tree.taiga.io/project/penpot/issue/4905) ### :heart: Community contributions by (Thank you!) - To @ondrejkonec: for contributing to the code with: diff --git a/frontend/src/app/main/ui/workspace/viewport.cljs b/frontend/src/app/main/ui/workspace/viewport.cljs index 6b1952b14..3bbd9bd1c 100644 --- a/frontend/src/app/main/ui/workspace/viewport.cljs +++ b/frontend/src/app/main/ui/workspace/viewport.cljs @@ -134,12 +134,14 @@ ;; STREAMS move-stream (mf/use-memo #(rx/subject)) - frame-parent (mf/use-memo + guide-frame (mf/use-memo (mf/deps @hover-ids base-objects) (fn [] - (let [parent (get base-objects (last @hover-ids))] - (when (= :frame (:type parent)) - parent)))) + (let [parent-id + (->> @hover-ids + (d/seek (partial cph/root-frame? base-objects)))] + (when (some? parent-id) + (get base-objects parent-id))))) zoom (d/check-num zoom 1) drawing-tool (:tool drawing) @@ -494,7 +496,7 @@ [:& guides/viewport-guides {:zoom zoom :vbox vbox - :hover-frame frame-parent + :hover-frame guide-frame :disabled-guides? disabled-guides? :modifiers modifiers}])