0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 14:39:45 -05:00

🐛 Fix scroll automatically to layer item

This commit is contained in:
Aitor 2023-08-24 13:31:06 +02:00
parent f69e141ac1
commit 8593ca1310
2 changed files with 4 additions and 3 deletions

View file

@ -4,7 +4,7 @@
### :sparkles: New features
- Navigate up in layer lierarchy with Shift+Enter shortcut [Taiga #5734](https://tree.taiga.io/project/penpot/us/5734)
- Navigate up in layer hierarchy with Shift+Enter shortcut [Taiga #5734](https://tree.taiga.io/project/penpot/us/5734)
## 1.19.1

View file

@ -175,6 +175,7 @@
;; seek for an alternate solution. Maybe use-context?
scroll-node (dom/get-parent-with-data node "scrollContainer")
parent-node (dom/get-parent-at node 2)
first-child-node (dom/get-first-child parent-node)
subid
(when (and single? selected?)
@ -184,9 +185,9 @@
#(let [scroll-distance-ratio (dom/get-scroll-distance-ratio node scroll-node)
scroll-behavior (if (> scroll-distance-ratio 1) "instant" "smooth")]
(if scroll-to
(dom/scroll-into-view! parent-node #js {:block "center" :behavior scroll-behavior :inline "start"})
(dom/scroll-into-view! first-child-node #js {:block "center" :behavior scroll-behavior :inline "start"})
(do
(dom/scroll-into-view-if-needed! parent-node #js {:block "center" :behavior scroll-behavior :inline "start"})
(dom/scroll-into-view-if-needed! first-child-node #js {:block "center" :behavior scroll-behavior :inline "start"})
(reset! scroll-to-middle? true)))))))]
#(when (some? subid)