From c477328da46e2360a328f381fbb57a409d3269c7 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 3 Nov 2021 11:50:59 +0100 Subject: [PATCH] :bug: Fix problem with view mode comments --- CHANGES.md | 1 + frontend/src/app/main/ui/viewer/comments.cljs | 23 ++++++++----------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 63118b728..ab9e7656c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ - Fix undo stacking when changing color from color-picker [Taiga #2191](https://tree.taiga.io/project/penpot/issue/2191) - Fix pages dropdown in viewer [Taiga #2087](https://tree.taiga.io/project/penpot/issue/2087) - Fix problem when exporting texts with gradients or opacity [Taiga #2200](https://tree.taiga.io/project/penpot/issue/2200) +- Fix problem with view mode comments [Taiga #](https://tree.taiga.io/project/penpot/issue/2226) ### :arrow_up: Deps updates ### :heart: Community contributions by (Thank you!) diff --git a/frontend/src/app/main/ui/viewer/comments.cljs b/frontend/src/app/main/ui/viewer/comments.cljs index 09ebfb384..096237a10 100644 --- a/frontend/src/app/main/ui/viewer/comments.cljs +++ b/frontend/src/app/main/ui/viewer/comments.cljs @@ -6,10 +6,8 @@ (ns app.main.ui.viewer.comments (:require - [app.common.data :as d] [app.common.geom.matrix :as gmt] [app.common.geom.point :as gpt] - [app.common.geom.shapes :as geom] [app.main.data.comments :as dcm] [app.main.data.events :as ev] [app.main.refs :as refs] @@ -80,6 +78,7 @@ (mf/defc comments-layer [{:keys [zoom file users frame page] :as props}] (let [profile (mf/deref refs/profile) + threads-map (mf/deref threads-ref) modifier1 (-> (gpt/point (:x frame) (:y frame)) (gpt/negate) @@ -88,16 +87,12 @@ modifier2 (-> (gpt/point (:x frame) (:y frame)) (gmt/translate-matrix)) - threads-map (->> (mf/deref threads-ref) - (d/mapm #(update %2 :position gpt/transform modifier1))) - cstate (mf/deref refs/comments-local) - mframe (geom/transform-shape frame) threads (->> (vals threads-map) (dcm/apply-filters cstate profile) (filter (fn [{:keys [position]}] - (frame-contains? mframe position)))) + (frame-contains? frame position)))) on-bubble-click (mf/use-callback @@ -140,14 +135,16 @@ [:div.viewer-comments-container [:div.threads (for [item threads] - [:& cmt/thread-bubble {:thread item - :zoom zoom - :on-click on-bubble-click - :open? (= (:id item) (:open cstate)) - :key (:seqn item)}]) + (let [item (update item :position gpt/transform modifier1)] + [:& cmt/thread-bubble {:thread item + :zoom zoom + :on-click on-bubble-click + :open? (= (:id item) (:open cstate)) + :key (:seqn item)}])) (when-let [id (:open cstate)] - (when-let [thread (get threads-map id)] + (when-let [thread (-> (get threads-map id) + (update :position gpt/transform modifier1))] [:& cmt/thread-comments {:thread thread :users users :zoom zoom}]))