0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-14 08:41:48 -05:00

🐛 Fix problem with view mode comments

This commit is contained in:
alonso.torres 2021-11-03 11:50:59 +01:00 committed by Andrey Antukh
parent 214c64c49e
commit c477328da4
2 changed files with 11 additions and 13 deletions

View file

@ -14,6 +14,7 @@
- Fix undo stacking when changing color from color-picker [Taiga #2191](https://tree.taiga.io/project/penpot/issue/2191) - 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 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 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 ### :arrow_up: Deps updates
### :heart: Community contributions by (Thank you!) ### :heart: Community contributions by (Thank you!)

View file

@ -6,10 +6,8 @@
(ns app.main.ui.viewer.comments (ns app.main.ui.viewer.comments
(:require (:require
[app.common.data :as d]
[app.common.geom.matrix :as gmt] [app.common.geom.matrix :as gmt]
[app.common.geom.point :as gpt] [app.common.geom.point :as gpt]
[app.common.geom.shapes :as geom]
[app.main.data.comments :as dcm] [app.main.data.comments :as dcm]
[app.main.data.events :as ev] [app.main.data.events :as ev]
[app.main.refs :as refs] [app.main.refs :as refs]
@ -80,6 +78,7 @@
(mf/defc comments-layer (mf/defc comments-layer
[{:keys [zoom file users frame page] :as props}] [{:keys [zoom file users frame page] :as props}]
(let [profile (mf/deref refs/profile) (let [profile (mf/deref refs/profile)
threads-map (mf/deref threads-ref)
modifier1 (-> (gpt/point (:x frame) (:y frame)) modifier1 (-> (gpt/point (:x frame) (:y frame))
(gpt/negate) (gpt/negate)
@ -88,16 +87,12 @@
modifier2 (-> (gpt/point (:x frame) (:y frame)) modifier2 (-> (gpt/point (:x frame) (:y frame))
(gmt/translate-matrix)) (gmt/translate-matrix))
threads-map (->> (mf/deref threads-ref)
(d/mapm #(update %2 :position gpt/transform modifier1)))
cstate (mf/deref refs/comments-local) cstate (mf/deref refs/comments-local)
mframe (geom/transform-shape frame)
threads (->> (vals threads-map) threads (->> (vals threads-map)
(dcm/apply-filters cstate profile) (dcm/apply-filters cstate profile)
(filter (fn [{:keys [position]}] (filter (fn [{:keys [position]}]
(frame-contains? mframe position)))) (frame-contains? frame position))))
on-bubble-click on-bubble-click
(mf/use-callback (mf/use-callback
@ -140,14 +135,16 @@
[:div.viewer-comments-container [:div.viewer-comments-container
[:div.threads [:div.threads
(for [item threads] (for [item threads]
[:& cmt/thread-bubble {:thread item (let [item (update item :position gpt/transform modifier1)]
:zoom zoom [:& cmt/thread-bubble {:thread item
:on-click on-bubble-click :zoom zoom
:open? (= (:id item) (:open cstate)) :on-click on-bubble-click
:key (:seqn item)}]) :open? (= (:id item) (:open cstate))
:key (:seqn item)}]))
(when-let [id (:open cstate)] (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 [:& cmt/thread-comments {:thread thread
:users users :users users
:zoom zoom}])) :zoom zoom}]))