Editing on double click

This commit is contained in:
alonso.torres 2023-05-24 12:48:30 +02:00
parent c0342a2c75
commit 7b410d46ec
2 changed files with 7 additions and 6 deletions

View file

@ -168,7 +168,7 @@
on-click (actions/on-click hover selected edition drawing-path? drawing-tool space? selrect z?) on-click (actions/on-click hover selected edition drawing-path? drawing-tool space? selrect z?)
on-context-menu (actions/on-context-menu hover hover-ids workspace-read-only?) on-context-menu (actions/on-context-menu hover hover-ids workspace-read-only?)
on-double-click (actions/on-double-click hover hover-ids drawing-path? base-objects edition drawing-tool z? workspace-read-only?) on-double-click (actions/on-double-click hover hover-ids hover-top-frame-id drawing-path? base-objects edition drawing-tool z? workspace-read-only?)
on-drag-enter (actions/on-drag-enter) on-drag-enter (actions/on-drag-enter)
on-drag-over (actions/on-drag-over) on-drag-over (actions/on-drag-over)
on-drop (actions/on-drop file) on-drop (actions/on-drop file)
@ -204,7 +204,8 @@
(>= zoom 8)) (>= zoom 8))
show-text-editor? (and editing-shape (= :text (:type editing-shape))) show-text-editor? (and editing-shape (= :text (:type editing-shape)))
hover-grid? (and (some? @hover-top-frame-id) (ctl/grid-layout? objects @hover-top-frame-id)) hover-grid? (and (some? @hover-top-frame-id)
(ctl/grid-layout? objects @hover-top-frame-id))
show-grid-editor? (and editing-shape (ctl/grid-layout? editing-shape)) show-grid-editor? (and editing-shape (ctl/grid-layout? editing-shape))
show-presence? page-id show-presence? page-id

View file

@ -187,10 +187,10 @@
(st/emit! (dw/increase-zoom pt))))))))) (st/emit! (dw/increase-zoom pt)))))))))
(defn on-double-click (defn on-double-click
[hover hover-ids drawing-path? objects edition drawing-tool z? workspace-read-only?] [hover hover-ids hover-top-frame-id drawing-path? objects edition drawing-tool z? workspace-read-only?]
(mf/use-callback (mf/use-callback
(mf/deps @hover @hover-ids drawing-path? edition drawing-tool @z? workspace-read-only?) (mf/deps @hover @hover-ids @hover-top-frame-id drawing-path? edition drawing-tool @z? workspace-read-only?)
(fn [event] (fn [event]
(dom/stop-propagation event) (dom/stop-propagation event)
(when-not @z? (when-not @z?
@ -214,8 +214,8 @@
(st/emit! (dw/select-shape id) (st/emit! (dw/select-shape id)
(dw/start-editing-selected)) (dw/start-editing-selected))
(ctl/grid-layout? shape) (ctl/grid-layout? objects @hover-top-frame-id)
(st/emit! (dw/start-edition-mode id)) (st/emit! (dw/start-edition-mode @hover-top-frame-id))
:else :else
(let [;; We only get inside childrens of the hovering shape (let [;; We only get inside childrens of the hovering shape