From 2b2d7bc40696572f2a06776a3fa6a1b0c063eb62 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Mon, 28 Aug 2023 13:29:22 +0200 Subject: [PATCH 1/4] :bug: Fix rulers --- frontend/src/app/main/ui/workspace/viewport/actions.cljs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/viewport/actions.cljs b/frontend/src/app/main/ui/workspace/viewport/actions.cljs index 370285522..4535a030d 100644 --- a/frontend/src/app/main/ui/workspace/viewport/actions.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/actions.cljs @@ -56,7 +56,8 @@ (.setPointerCapture target (.-pointerId bevent)))) (when (or (dom/class? (dom/get-target bevent) "viewport-controls") - (dom/child? (dom/get-target bevent) (dom/query ".viewport-controls"))) + (dom/class? (dom/get-target bevent) "viewport-selrect") + (dom/child? (dom/get-target bevent) (dom/query ".grid-layout-editor"))) (dom/stop-propagation bevent) @@ -161,7 +162,7 @@ (fn [event] (when (and (nil? selrect) (or (dom/class? (dom/get-target event) "viewport-controls") - (dom/child? (dom/get-target event) (dom/query ".viewport-controls")) + (dom/child? (dom/get-target event) (dom/query ".grid-layout-editor")) (dom/class? (dom/get-target event) "viewport-selrect"))) (let [ctrl? (kbd/ctrl? event) shift? (kbd/shift? event) @@ -236,7 +237,7 @@ (dom/prevent-default event) (when-not workspace-read-only? (when (or (dom/class? (dom/get-target event) "viewport-controls") - (dom/child? (dom/get-target event) (dom/query ".viewport-controls")) + (dom/child? (dom/get-target event) (dom/query ".grid-layout-editor")) (dom/class? (dom/get-target event) "viewport-selrect") workspace-read-only?) (let [position (dom/get-client-position event)] From 27534702fb731c6a8b33877ed596fd25c25b3b42 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Mon, 28 Aug 2023 15:54:10 +0200 Subject: [PATCH 2/4] :bug: Fix viewer inspect code --- frontend/src/app/main/ui/viewer/inspect/render.cljs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/main/ui/viewer/inspect/render.cljs b/frontend/src/app/main/ui/viewer/inspect/render.cljs index a3cf6cc4d..a2d944bfa 100644 --- a/frontend/src/app/main/ui/viewer/inspect/render.cljs +++ b/frontend/src/app/main/ui/viewer/inspect/render.cljs @@ -170,7 +170,9 @@ (mf/use-memo (mf/deps objects) #(svg-raw-container-factory objects))] (when (and shape (not (:hidden shape))) - (let [shape (gsh/translate-to-frame shape frame) + (let [shape (if frame + (gsh/translate-to-frame shape frame) + shape) opts #js {:shape shape :frame frame}] (case (:type shape) From cf2ee435c02321f9444bd39b8ea43b5b4e97e4a0 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 29 Aug 2023 10:31:10 +0200 Subject: [PATCH 3/4] :bug: Fix incorrect event handling on dropdown menu Related to react18 event handling new behavior --- .../src/app/main/ui/components/dropdown.cljs | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/frontend/src/app/main/ui/components/dropdown.cljs b/frontend/src/app/main/ui/components/dropdown.cljs index 8be2f498d..f27662421 100644 --- a/frontend/src/app/main/ui/components/dropdown.cljs +++ b/frontend/src/app/main/ui/components/dropdown.cljs @@ -10,6 +10,7 @@ [app.util.dom :as dom] [app.util.globals :as globals] [app.util.keyboard :as kbd] + [app.util.timers :as tm] [goog.events :as events] [goog.object :as gobj] [rumext.v2 :as mf]) @@ -18,24 +19,26 @@ (mf/defc dropdown' {::mf/wrap-props false} [props] - (let [children (gobj/get props "children") - on-close (gobj/get props "on-close") - ref (gobj/get props "container") + (let [children (gobj/get props "children") + on-close (gobj/get props "on-close") + container-ref (gobj/get props "container") + listening-ref (mf/use-ref nil) on-click (fn [event] - (let [target (dom/get-target event) + (when (mf/ref-val listening-ref) + (let [target (dom/get-target event) - ;; MacOS ctrl+click sends two events: context-menu and click. - ;; In order to not have two handlings we ignore ctrl+click for this platform - mac-ctrl-click? (and (cfg/check-platform? :macos) (kbd/ctrl? event))] - (when (and (not mac-ctrl-click?) - (not (.-data-no-close ^js target))) - (if ref - (let [parent (mf/ref-val ref)] - (when-not (or (not parent) (.contains parent target)) - (on-close))) - (on-close))))) + ;; MacOS ctrl+click sends two events: context-menu and click. + ;; In order to not have two handlings we ignore ctrl+click for this platform + mac-ctrl-click? (and (cfg/check-platform? :macos) (kbd/ctrl? event))] + (when (and (not mac-ctrl-click?) + (not (.-data-no-close ^js target))) + (if container-ref + (let [parent (mf/ref-val container-ref)] + (when-not (or (not parent) (.contains parent target)) + (on-close))) + (on-close)))))) on-keyup (fn [event] @@ -47,8 +50,8 @@ (let [keys [(events/listen globals/document EventType.CLICK on-click) (events/listen globals/document EventType.CONTEXTMENU on-click) (events/listen globals/document EventType.KEYUP on-keyup)]] - #(doseq [key keys] - (events/unlistenByKey key))))] + (tm/schedule #(mf/set-ref-val! listening-ref true)) + #(run! events/unlistenByKey keys)))] (mf/use-effect on-mount) children)) From 67eb305202f3d1bd4c676b39e9247a0ac433a632 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Tue, 29 Aug 2023 11:52:35 +0200 Subject: [PATCH 4/4] :bug: Fix duplicate and copy/paste frames internal error --- frontend/src/app/main/data/workspace/selection.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index 2c2763f75..6dc81868a 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -448,7 +448,7 @@ :use-for-thumbnail?) (cond-> - (or group? bool?) + (or frame? group? bool?) (assoc :shapes [])) (gsh/move delta)