From eabfa7a54194e4a7c76c670b81f42ef4bbef96b3 Mon Sep 17 00:00:00 2001 From: Eva Date: Tue, 17 May 2022 16:38:24 +0200 Subject: [PATCH] :bug: Fix scroll into view with big groups --- frontend/src/app/main/ui/workspace/sidebar/layers.cljs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/layers.cljs b/frontend/src/app/main/ui/workspace/sidebar/layers.cljs index b76e9b7d8..e13502999 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/layers.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/layers.cljs @@ -32,10 +32,9 @@ (l/derived (l/in [:workspace-local :shape-for-rename]) st/state)) (mf/defc layer-name - [{:keys [shape on-start-edit on-stop-edit] :as props}] + [{:keys [shape on-start-edit on-stop-edit name-ref] :as props}] (let [local (mf/use-state {}) shape-for-rename (mf/deref shape-for-rename-ref) - name-ref (mf/use-ref) start-edit (fn [] (on-start-edit) @@ -179,13 +178,15 @@ :detect-center? container? :data {:id (:id item) :index index - :name (:name item)})] + :name (:name item)}) + + ref (mf/use-ref)] (mf/use-effect (mf/deps selected? selected) (fn [] (let [single? (= (count selected) 1) - node (mf/ref-val dref) + node (mf/ref-val ref) subid (when (and single? selected?) @@ -218,6 +219,7 @@ :on-double-click #(dom/stop-propagation %)} [:& si/element-icon {:shape item}] [:& layer-name {:shape item + :name-ref ref :on-start-edit #(reset! disable-drag true) :on-stop-edit #(reset! disable-drag false)}]