diff --git a/frontend/src/app/main/ui/workspace/viewport.cljs b/frontend/src/app/main/ui/workspace/viewport.cljs index 6e73069a5..8c959a0f6 100644 --- a/frontend/src/app/main/ui/workspace/viewport.cljs +++ b/frontend/src/app/main/ui/workspace/viewport.cljs @@ -95,10 +95,12 @@ ;; Only when we have all the selected shapes in one frame 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]))) (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]))) + text-editing? (and edition (= :text (get-in objects [edition :type]))) on-click (actions/on-click hover selected edition drawing-path? drawing-tool) on-context-menu (actions/on-context-menu hover) @@ -106,7 +108,7 @@ on-drag-enter (actions/on-drag-enter) on-drag-over (actions/on-drag-over) 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-pointer-down (actions/on-pointer-down) on-pointer-enter (actions/on-pointer-enter in-viewport?) diff --git a/frontend/src/app/main/ui/workspace/viewport/actions.cljs b/frontend/src/app/main/ui/workspace/viewport/actions.cljs index a4ba68711..f7550428f 100644 --- a/frontend/src/app/main/ui/workspace/viewport/actions.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/actions.cljs @@ -27,9 +27,9 @@ (:import goog.events.WheelEvent)) (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/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] (when (or (dom/class? (dom/get-target bevent) "viewport-controls") (dom/class? (dom/get-target bevent) "viewport-selrect")) @@ -44,9 +44,7 @@ middle-click? (= 2 (.-which event)) frame? (= :frame type) - selected? (contains? selected id) - - drawing-path? (= :draw (get-in edit-path [edition :edit-mode]))] + selected? (contains? selected id)] (when middle-click? (dom/prevent-default bevent) @@ -61,13 +59,13 @@ (when (and (not text-editing?) (not blocked) (not hidden) - (not (#{:comments :path} drawing-tool)) + (not create-comment?) (not drawing-path?)) (cond drawing-tool (st/emit! (dd/start-drawing drawing-tool)) - (and edit-path (contains? edit-path edition)) + path-editing? ;; Handle path node area selection (st/emit! (dwdp/handle-selection shift?))