mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 08:50:57 -05:00
🐛 Fix problem with selection after create paths
This commit is contained in:
parent
91f60000b3
commit
907f39c73f
2 changed files with 9 additions and 9 deletions
|
@ -95,10 +95,12 @@
|
||||||
;; Only when we have all the selected shapes in one frame
|
;; Only when we have all the selected shapes in one frame
|
||||||
selected-frame (when (= (count selected-frames) 1) (get objects (first selected-frames)))
|
selected-frame (when (= (count selected-frames) 1) (get objects (first selected-frames)))
|
||||||
|
|
||||||
|
|
||||||
|
create-comment? (= :comments drawing-tool)
|
||||||
drawing-path? (or (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))))
|
(and (some? drawing-obj) (= :path (:type drawing-obj))))
|
||||||
text-editing? (and edition (= :text (get-in objects [edition :type])))
|
|
||||||
path-editing? (and edition (= :path (get-in objects [edition :type])))
|
path-editing? (and edition (= :path (get-in objects [edition :type])))
|
||||||
|
text-editing? (and edition (= :text (get-in objects [edition :type])))
|
||||||
|
|
||||||
on-click (actions/on-click hover selected edition drawing-path? drawing-tool)
|
on-click (actions/on-click hover selected edition drawing-path? drawing-tool)
|
||||||
on-context-menu (actions/on-context-menu hover)
|
on-context-menu (actions/on-context-menu hover)
|
||||||
|
@ -106,7 +108,7 @@
|
||||||
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 viewport-ref zoom)
|
on-drop (actions/on-drop file viewport-ref zoom)
|
||||||
on-mouse-down (actions/on-mouse-down @hover drawing-tool text-editing? edition edit-path selected)
|
on-mouse-down (actions/on-mouse-down @hover selected edition drawing-tool text-editing? path-editing? drawing-path? create-comment?)
|
||||||
on-mouse-up (actions/on-mouse-up disable-paste)
|
on-mouse-up (actions/on-mouse-up disable-paste)
|
||||||
on-pointer-down (actions/on-pointer-down)
|
on-pointer-down (actions/on-pointer-down)
|
||||||
on-pointer-enter (actions/on-pointer-enter in-viewport?)
|
on-pointer-enter (actions/on-pointer-enter in-viewport?)
|
||||||
|
|
|
@ -27,9 +27,9 @@
|
||||||
(:import goog.events.WheelEvent))
|
(:import goog.events.WheelEvent))
|
||||||
|
|
||||||
(defn on-mouse-down
|
(defn on-mouse-down
|
||||||
[{:keys [id blocked hidden type]} drawing-tool text-editing? edition edit-path selected]
|
[{:keys [id blocked hidden type]} selected edition drawing-tool text-editing? path-editing? drawing-path? create-comment?]
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(mf/deps id blocked hidden type drawing-tool text-editing? edition edit-path selected)
|
(mf/deps id blocked hidden type selected edition drawing-tool text-editing? path-editing? drawing-path? create-comment?)
|
||||||
(fn [bevent]
|
(fn [bevent]
|
||||||
(when (or (dom/class? (dom/get-target bevent) "viewport-controls")
|
(when (or (dom/class? (dom/get-target bevent) "viewport-controls")
|
||||||
(dom/class? (dom/get-target bevent) "viewport-selrect"))
|
(dom/class? (dom/get-target bevent) "viewport-selrect"))
|
||||||
|
@ -44,9 +44,7 @@
|
||||||
middle-click? (= 2 (.-which event))
|
middle-click? (= 2 (.-which event))
|
||||||
|
|
||||||
frame? (= :frame type)
|
frame? (= :frame type)
|
||||||
selected? (contains? selected id)
|
selected? (contains? selected id)]
|
||||||
|
|
||||||
drawing-path? (= :draw (get-in edit-path [edition :edit-mode]))]
|
|
||||||
|
|
||||||
(when middle-click?
|
(when middle-click?
|
||||||
(dom/prevent-default bevent)
|
(dom/prevent-default bevent)
|
||||||
|
@ -61,13 +59,13 @@
|
||||||
(when (and (not text-editing?)
|
(when (and (not text-editing?)
|
||||||
(not blocked)
|
(not blocked)
|
||||||
(not hidden)
|
(not hidden)
|
||||||
(not (#{:comments :path} drawing-tool))
|
(not create-comment?)
|
||||||
(not drawing-path?))
|
(not drawing-path?))
|
||||||
(cond
|
(cond
|
||||||
drawing-tool
|
drawing-tool
|
||||||
(st/emit! (dd/start-drawing drawing-tool))
|
(st/emit! (dd/start-drawing drawing-tool))
|
||||||
|
|
||||||
(and edit-path (contains? edit-path edition))
|
path-editing?
|
||||||
;; Handle path node area selection
|
;; Handle path node area selection
|
||||||
(st/emit! (dwdp/handle-selection shift?))
|
(st/emit! (dwdp/handle-selection shift?))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue