0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-26 08:29:42 -05:00

Add performance enhancements to viewport comments layer

This commit is contained in:
Andrey Antukh 2024-03-04 14:16:57 +01:00
parent 638cf6daff
commit 4106e8da56

View file

@ -27,8 +27,13 @@
(mf/defc comments-layer (mf/defc comments-layer
{::mf/props :obj} {::mf/props :obj}
[{:keys [vbox vport zoom file-id page-id drawing] :as props}] [{:keys [vbox vport zoom file-id page-id drawing] :as props}]
(let [pos-x (* (- (:x vbox)) zoom) (let [vbox-x (dm/get-prop vbox :x)
pos-y (* (- (:y vbox)) zoom) vbox-y (dm/get-prop vbox :y)
vport-w (dm/get-prop vport :width)
vport-h (dm/get-prop vport :height)
pos-x (* (- vbox-x) zoom)
pos-y (* (- vbox-y) zoom)
profile (mf/deref refs/profile) profile (mf/deref refs/profile)
users (mf/deref refs/current-file-comments-users) users (mf/deref refs/current-file-comments-users)
@ -64,8 +69,8 @@
[:div {:class (stl/css :comments-section)} [:div {:class (stl/css :comments-section)}
[:div [:div
{:class (stl/css :workspace-comments-container) {:class (stl/css :workspace-comments-container)
:style {:width (dm/str (:width vport) "px") :style {:width (dm/str vport-w "px")
:height (dm/str (:height vport) "px")}} :height (dm/str vport-h "px")}}
[:div {:class (stl/css :threads) [:div {:class (stl/css :threads)
:style {:transform (dm/fmt "translate(%px, %px)" pos-x pos-y)}} :style {:transform (dm/fmt "translate(%px, %px)" pos-x pos-y)}}
(for [item threads] (for [item threads]