mirror of
https://github.com/penpot/penpot.git
synced 2026-05-25 01:43:40 +00:00
🐛 Fix double-clicking a text element selected via Ctrl+click in nested layouts jumps to parent instead of entering edit mode
This commit is contained in:
parent
db1e2a9cfc
commit
03487f90e5
@ -200,7 +200,7 @@
|
|||||||
|
|
||||||
on-click (actions/on-click hover selected edition path-drawing? drawing-tool space? selrect z?)
|
on-click (actions/on-click hover selected edition path-drawing? drawing-tool space? selrect z?)
|
||||||
on-context-menu (actions/on-context-menu hover hover-ids read-only?)
|
on-context-menu (actions/on-context-menu hover hover-ids read-only?)
|
||||||
on-double-click (actions/on-double-click hover hover-ids hover-top-frame-id path-drawing? base-objects edition drawing-tool z? read-only?)
|
on-double-click (actions/on-double-click hover hover-ids selected hover-top-frame-id path-drawing? base-objects edition drawing-tool z? read-only?)
|
||||||
|
|
||||||
comp-inst-ref (mf/use-ref false)
|
comp-inst-ref (mf/use-ref false)
|
||||||
on-drag-enter (actions/on-drag-enter comp-inst-ref)
|
on-drag-enter (actions/on-drag-enter comp-inst-ref)
|
||||||
|
|||||||
@ -196,10 +196,10 @@
|
|||||||
(st/emit! (dw/increase-zoom pt)))))))))
|
(st/emit! (dw/increase-zoom pt)))))))))
|
||||||
|
|
||||||
(defn on-double-click
|
(defn on-double-click
|
||||||
[hover hover-ids hover-top-frame-id drawing-path? objects edition drawing-tool z? read-only?]
|
[hover hover-ids selected hover-top-frame-id drawing-path? objects edition drawing-tool z? read-only?]
|
||||||
|
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(mf/deps @hover @hover-ids @hover-top-frame-id drawing-path? edition drawing-tool @z? read-only?)
|
(mf/deps @hover @hover-ids selected @hover-top-frame-id drawing-path? edition drawing-tool @z? read-only?)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(dom/stop-propagation event)
|
(dom/stop-propagation event)
|
||||||
(when-not @z?
|
(when-not @z?
|
||||||
@ -208,7 +208,16 @@
|
|||||||
alt? (kbd/alt? event)
|
alt? (kbd/alt? event)
|
||||||
meta? (kbd/meta? event)
|
meta? (kbd/meta? event)
|
||||||
|
|
||||||
{:keys [id type] :as shape} (or @hover (get objects (first @hover-ids)))
|
selected-id-under-cursor
|
||||||
|
(->> @hover-ids
|
||||||
|
(filter selected)
|
||||||
|
last)
|
||||||
|
|
||||||
|
{:keys [id type] :as shape}
|
||||||
|
(or (when selected-id-under-cursor
|
||||||
|
(get objects selected-id-under-cursor))
|
||||||
|
@hover
|
||||||
|
(get objects (first @hover-ids)))
|
||||||
|
|
||||||
editable? (contains? #{:text :rect :path :image :circle} type)
|
editable? (contains? #{:text :rect :path :image :circle} type)
|
||||||
|
|
||||||
|
|||||||
@ -257,7 +257,7 @@
|
|||||||
|
|
||||||
on-click (actions/on-click hover selected edition path-drawing? drawing-tool space? selrect z?)
|
on-click (actions/on-click hover selected edition path-drawing? drawing-tool space? selrect z?)
|
||||||
on-context-menu (actions/on-context-menu hover hover-ids read-only?)
|
on-context-menu (actions/on-context-menu hover hover-ids read-only?)
|
||||||
on-double-click (actions/on-double-click hover hover-ids hover-top-frame-id path-drawing? base-objects edition drawing-tool z? read-only?)
|
on-double-click (actions/on-double-click hover hover-ids selected hover-top-frame-id path-drawing? base-objects edition drawing-tool z? read-only?)
|
||||||
|
|
||||||
comp-inst-ref (mf/use-ref false)
|
comp-inst-ref (mf/use-ref false)
|
||||||
on-drag-enter (actions/on-drag-enter comp-inst-ref)
|
on-drag-enter (actions/on-drag-enter comp-inst-ref)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user