0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-13 16:21:57 -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 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!)

View file

@ -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}]))