mirror of
https://github.com/penpot/penpot.git
synced 2025-03-12 07:41:43 -05:00
🐛 Fixed problem when editing paths
This commit is contained in:
parent
88a3548d7e
commit
9e348ecc99
3 changed files with 12 additions and 11 deletions
|
@ -547,8 +547,8 @@
|
|||
(update [_ state]
|
||||
(let [id (get-in state [:workspace-local :edition])]
|
||||
(-> state
|
||||
(update-in [:workspace-local :hover] disj id)
|
||||
(update :workspace-local dissoc :edition))))))
|
||||
(update :workspace-local dissoc :edition)
|
||||
(cond-> (some? id) (update-in [:workspace-local :edit-path] dissoc id)))))))
|
||||
|
||||
(defn get-shape-layer-position
|
||||
[objects selected attrs]
|
||||
|
|
|
@ -87,10 +87,11 @@
|
|||
drawing-tool (:tool drawing)
|
||||
drawing-obj (:object drawing)
|
||||
|
||||
drawing-path? (and edition (= :draw (get-in edit-path [edition :edit-mode])))
|
||||
drawing-path? (or (and edition (= :draw (get-in edit-path [edition :edit-mode])))
|
||||
(and (some? drawing-obj) (= :path (:type drawing-obj))))
|
||||
text-editing? (and edition (= :text (get-in objects [edition :type])))
|
||||
|
||||
on-click (actions/on-click hover selected)
|
||||
on-click (actions/on-click hover selected edition drawing-path?)
|
||||
on-context-menu (actions/on-context-menu hover)
|
||||
on-double-click (actions/on-double-click hover hover-ids drawing-path? objects)
|
||||
on-drag-enter (actions/on-drag-enter)
|
||||
|
@ -115,7 +116,7 @@
|
|||
show-draw-area? drawing-obj
|
||||
show-gradient-handlers? (= (count selected) 1)
|
||||
show-grids? (contains? layout :display-grid)
|
||||
show-outlines? (and (nil? transform) (not edit-path))
|
||||
show-outlines? (and (nil? transform) (not edition) (not drawing-obj))
|
||||
show-pixel-grid? (>= zoom 8)
|
||||
show-presence? page-id
|
||||
show-prototypes? (= options-mode :prototype)
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
(defn on-mouse-down
|
||||
[{:keys [id blocked hidden type]} drawing-tool text-editing? edition edit-path selected]
|
||||
(mf/use-callback
|
||||
(mf/deps id blocked hidden type drawing-tool text-editing? edition selected)
|
||||
(mf/deps id blocked hidden type drawing-tool text-editing? edition edit-path selected)
|
||||
(fn [bevent]
|
||||
(when (dom/class? (dom/get-target bevent) "viewport-controls")
|
||||
(dom/stop-propagation bevent)
|
||||
|
@ -63,14 +63,14 @@
|
|||
(and drawing-tool (not (#{:comments :path} drawing-tool)))
|
||||
(st/emit! (dd/start-drawing drawing-tool))
|
||||
|
||||
edit-path
|
||||
(and edit-path (contains? edit-path edition))
|
||||
;; Handle node select-drawing. NOP at the moment
|
||||
nil
|
||||
|
||||
(or (not id) (and frame? (not selected?)))
|
||||
(st/emit! (dw/handle-selection shift?))
|
||||
|
||||
:else
|
||||
(not drawing-tool)
|
||||
(st/emit! (when (or shift? (not selected?))
|
||||
(dw/select-shape id shift?))
|
||||
(when (not shift?)
|
||||
|
@ -119,9 +119,9 @@
|
|||
(reset! frame-hover nil))))
|
||||
|
||||
(defn on-click
|
||||
[hover selected]
|
||||
[hover selected edition drawing-path?]
|
||||
(mf/use-callback
|
||||
(mf/deps @hover selected)
|
||||
(mf/deps @hover selected edition drawing-path?)
|
||||
(fn [event]
|
||||
(when (dom/class? (dom/get-target event) "viewport-controls")
|
||||
(let [ctrl? (kbd/ctrl? event)
|
||||
|
@ -133,7 +133,7 @@
|
|||
selected? (contains? selected (:id @hover))]
|
||||
(st/emit! (ms/->MouseEvent :click ctrl? shift? alt?))
|
||||
|
||||
(when (and hovering? (not shift?) (not frame?) (not selected?))
|
||||
(when (and hovering? (not shift?) (not frame?) (not selected?) (not edition) (not drawing-path?))
|
||||
(st/emit! (dw/select-shape (:id @hover)))))))))
|
||||
|
||||
(defn on-double-click
|
||||
|
|
Loading…
Add table
Reference in a new issue