From 59ae0b0f55aa5c00ba08deb0a4cd8f9534a5ddba Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 2 Oct 2020 13:22:04 +0200 Subject: [PATCH] :sparkles: Scroll selected layer into view --- frontend/resources/styles/main/partials/sidebar-layers.scss | 1 + frontend/src/app/main/ui/workspace/sidebar/layers.cljs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/frontend/resources/styles/main/partials/sidebar-layers.scss b/frontend/resources/styles/main/partials/sidebar-layers.scss index ea8e23fd4..05c5db65d 100644 --- a/frontend/resources/styles/main/partials/sidebar-layers.scss +++ b/frontend/resources/styles/main/partials/sidebar-layers.scss @@ -64,6 +64,7 @@ } &.selected { + background-color: $colro-gray-60; svg { fill: $color-primary; diff --git a/frontend/src/app/main/ui/workspace/sidebar/layers.cljs b/frontend/src/app/main/ui/workspace/sidebar/layers.cljs index 41c928852..d3870a909 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/layers.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/layers.cljs @@ -185,6 +185,12 @@ :index index :name (:name item)})] + (mf/use-effect + (mf/deps selected?) + (fn [] + (when selected? + (.scrollIntoView (mf/ref-val dref) false)))) + [:li {:on-context-menu on-context-menu :ref dref :class (dom/classnames