mirror of
https://github.com/penpot/penpot.git
synced 2025-05-09 18:56:37 +02:00
🐛 Fix scroll into view with big groups
This commit is contained in:
parent
f290465edd
commit
eabfa7a541
1 changed files with 6 additions and 4 deletions
|
@ -32,10 +32,9 @@
|
||||||
(l/derived (l/in [:workspace-local :shape-for-rename]) st/state))
|
(l/derived (l/in [:workspace-local :shape-for-rename]) st/state))
|
||||||
|
|
||||||
(mf/defc layer-name
|
(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 {})
|
(let [local (mf/use-state {})
|
||||||
shape-for-rename (mf/deref shape-for-rename-ref)
|
shape-for-rename (mf/deref shape-for-rename-ref)
|
||||||
name-ref (mf/use-ref)
|
|
||||||
|
|
||||||
start-edit (fn []
|
start-edit (fn []
|
||||||
(on-start-edit)
|
(on-start-edit)
|
||||||
|
@ -179,13 +178,15 @@
|
||||||
:detect-center? container?
|
:detect-center? container?
|
||||||
:data {:id (:id item)
|
:data {:id (:id item)
|
||||||
:index index
|
:index index
|
||||||
:name (:name item)})]
|
:name (:name item)})
|
||||||
|
|
||||||
|
ref (mf/use-ref)]
|
||||||
|
|
||||||
(mf/use-effect
|
(mf/use-effect
|
||||||
(mf/deps selected? selected)
|
(mf/deps selected? selected)
|
||||||
(fn []
|
(fn []
|
||||||
(let [single? (= (count selected) 1)
|
(let [single? (= (count selected) 1)
|
||||||
node (mf/ref-val dref)
|
node (mf/ref-val ref)
|
||||||
|
|
||||||
subid
|
subid
|
||||||
(when (and single? selected?)
|
(when (and single? selected?)
|
||||||
|
@ -218,6 +219,7 @@
|
||||||
:on-double-click #(dom/stop-propagation %)}
|
:on-double-click #(dom/stop-propagation %)}
|
||||||
[:& si/element-icon {:shape item}]
|
[:& si/element-icon {:shape item}]
|
||||||
[:& layer-name {:shape item
|
[:& layer-name {:shape item
|
||||||
|
:name-ref ref
|
||||||
:on-start-edit #(reset! disable-drag true)
|
:on-start-edit #(reset! disable-drag true)
|
||||||
:on-stop-edit #(reset! disable-drag false)}]
|
:on-stop-edit #(reset! disable-drag false)}]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue