From d51338e7541621290d73e821d660ee02fbe78492 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 22 Feb 2024 14:46:06 +0100 Subject: [PATCH 1/4] :bug: Remove after delay event for not-frame shapes --- .../src/app/common/types/shape/interactions.cljc | 2 +- .../sidebar/options/menus/interactions.cljs | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/common/src/app/common/types/shape/interactions.cljc b/common/src/app/common/types/shape/interactions.cljc index 215ab1aa5..05724ebe8 100644 --- a/common/src/app/common/types/shape/interactions.cljc +++ b/common/src/app/common/types/shape/interactions.cljc @@ -176,7 +176,7 @@ (contains? event-types event-type)) (dm/assert! - "The `:after-delay` event type incompatible with frame shapes" + "The `:after-delay` event type incompatible with not frame shapes" (or (not= event-type :after-delay) (cfh/frame-shape? shape))) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/interactions.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/interactions.cljs index 766a6b3c0..fcef93100 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/interactions.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/interactions.cljs @@ -357,13 +357,14 @@ (update-interaction index #(ctsi/set-offset-effect % value))))) - event-type-options [{:value :click :label (tr "workspace.options.interaction-on-click")} - ;; TODO: need more UX research - ;; :mouse-over (tr "workspace.options.interaction-while-hovering") - ;; :mouse-press (tr "workspace.options.interaction-while-pressing") - {:value :mouse-enter :label (tr "workspace.options.interaction-mouse-enter")} - {:value :mouse-leave :label (tr "workspace.options.interaction-mouse-leave")} - {:value :after-delay :label (tr "workspace.options.interaction-after-delay")}] + event-type-options (-> [{:value :click :label (tr "workspace.options.interaction-on-click")} + ;; TODO: need more UX research + ;; :mouse-over (tr "workspace.options.interaction-while-hovering") + ;; :mouse-press (tr "workspace.options.interaction-while-pressing") + {:value :mouse-enter :label (tr "workspace.options.interaction-mouse-enter")} + {:value :mouse-leave :label (tr "workspace.options.interaction-mouse-leave")}] + (cond-> (cfh/frame-shape? shape) + (conj {:value :after-delay :label (tr "workspace.options.interaction-after-delay")}))) action-type-options [{:value :navigate :label (tr "workspace.options.interaction-navigate-to")} {:value :open-overlay :label (tr "workspace.options.interaction-open-overlay")} From fdf6f0dfefa25aecddc646f49c46293dca3eab2b Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 22 Feb 2024 16:42:26 +0100 Subject: [PATCH 2/4] :bug: Fix problem with snap to guides and zoom --- frontend/src/app/main/snap.cljs | 17 +++++++++-------- frontend/src/app/worker/snaps.cljs | 3 ++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/frontend/src/app/main/snap.cljs b/frontend/src/app/main/snap.cljs index 374ec676b..4715b1780 100644 --- a/frontend/src/app/main/snap.cljs +++ b/frontend/src/app/main/snap.cljs @@ -83,14 +83,15 @@ (defn get-snap-points [page-id frame-id remove-snap? zoom point coord] (let [value (get point coord) vbox @refs/vbox] - (->> (uw/ask! {:cmd :snaps/range-query - :page-id page-id - :frame-id frame-id - :axis coord - :bounds vbox - :ranges [[(- value (/ 0.5 zoom)) (+ value (/ 0.5 zoom))]]}) - (rx/take 1) - (rx/map (remove-from-snap-points remove-snap?))))) + (let [ranges [[(- value (/ 0.5 zoom)) (+ value (/ 0.5 zoom))]]] + (->> (uw/ask! {:cmd :snaps/range-query + :page-id page-id + :frame-id frame-id + :axis coord + :bounds vbox + :ranges ranges}) + (rx/take 1) + (rx/map (remove-from-snap-points remove-snap?)))))) (defn- search-snap [page-id frame-id points coord remove-snap? zoom] diff --git a/frontend/src/app/worker/snaps.cljs b/frontend/src/app/worker/snaps.cljs index c9dccd96b..ceecc5b89 100644 --- a/frontend/src/app/worker/snaps.cljs +++ b/frontend/src/app/worker/snaps.cljs @@ -28,7 +28,8 @@ [{:keys [page-id frame-id axis ranges bounds] :as message}] (let [match-bounds? (fn [[_ data]] - (some #(grc/contains-point? bounds %) (map :pt data)))] + (some #(or (= :guide (:type %)) + (grc/contains-point? bounds (:pt %))) data))] (->> (into [] (comp (mapcat #(sd/query @state page-id frame-id axis %)) (distinct)) From d45d6af0ecc9c9e57f3e63c466dc83f356e42b5a Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 22 Feb 2024 17:49:35 +0100 Subject: [PATCH 3/4] :bug: Fix problem with measure distances in workspace --- .../app/main/ui/workspace/viewport/hooks.cljs | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/viewport/hooks.cljs b/frontend/src/app/main/ui/workspace/viewport/hooks.cljs index a9ab0ffb3..1a8c45567 100644 --- a/frontend/src/app/main/ui/workspace/viewport/hooks.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/hooks.cljs @@ -291,7 +291,7 @@ (not (ctk/main-instance? obj)))) ;; Set with the elements to remove from the hover list - remove-id-xf + remove-hover-xf (cond mod? (filter grouped?) @@ -306,8 +306,25 @@ (and (contains? #{:group :bool} (dm/get-in objects [% :type])) (not (contains? child-parent? %))))))) - remove-id? - (into selected-with-parents remove-id-xf ids) + remove-measure-xf + (cond + mod? + (filter grouped?) + + (not mod?) + (let [child-parent? + (into #{} + (comp (remove #(cfh/group-like-shape? objects %)) + (mapcat #(cfh/get-parent-ids objects %))) + ids)] + (filter #(and (contains? #{:group :bool} (dm/get-in objects [% :type])) + (not (contains? child-parent? %)))))) + + remove-hover? + (into selected-with-parents remove-hover-xf ids) + + remove-measure? + (into selected-with-parents remove-measure-xf ids) no-fill-nested-frames? (fn [id] @@ -318,7 +335,7 @@ hover-shape (->> ids - (remove remove-id?) + (remove remove-hover?) (remove (partial cfh/hidden-parent? objects)) (remove #(and mod? (no-fill-nested-frames? %))) (filter #(or (empty? focus) (cpf/is-in-focus? objects focus %))) @@ -329,14 +346,12 @@ measure-hover-shape (when show-measures? (->> ids - (remove #(group-empty-space? % objects ids)) + (remove remove-measure?) (remove (partial cfh/hidden-parent? objects)) (remove #(and mod? (no-fill-nested-frames? %))) (filter #(or (empty? focus) (cpf/is-in-focus? objects focus %))) (first) (get objects)))] - - (reset! hover hover-shape) (reset! measure-hover measure-hover-shape) (reset! hover-ids ids))) From 8de6b0c553bd97bc4fdd41e42459e050ac33734a Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 22 Feb 2024 18:08:30 +0100 Subject: [PATCH 4/4] :bug: Add row/column gap to inspect tab --- frontend/src/app/main/snap.cljs | 20 +++++++++---------- .../ui/viewer/inspect/attributes/layout.cljs | 2 ++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/frontend/src/app/main/snap.cljs b/frontend/src/app/main/snap.cljs index 4715b1780..5e8f14431 100644 --- a/frontend/src/app/main/snap.cljs +++ b/frontend/src/app/main/snap.cljs @@ -82,16 +82,16 @@ (defn get-snap-points [page-id frame-id remove-snap? zoom point coord] (let [value (get point coord) - vbox @refs/vbox] - (let [ranges [[(- value (/ 0.5 zoom)) (+ value (/ 0.5 zoom))]]] - (->> (uw/ask! {:cmd :snaps/range-query - :page-id page-id - :frame-id frame-id - :axis coord - :bounds vbox - :ranges ranges}) - (rx/take 1) - (rx/map (remove-from-snap-points remove-snap?)))))) + vbox @refs/vbox + ranges [[(- value (/ 0.5 zoom)) (+ value (/ 0.5 zoom))]]] + (->> (uw/ask! {:cmd :snaps/range-query + :page-id page-id + :frame-id frame-id + :axis coord + :bounds vbox + :ranges ranges}) + (rx/take 1) + (rx/map (remove-from-snap-points remove-snap?))))) (defn- search-snap [page-id frame-id points coord remove-snap? zoom] diff --git a/frontend/src/app/main/ui/viewer/inspect/attributes/layout.cljs b/frontend/src/app/main/ui/viewer/inspect/attributes/layout.cljs index ecfb19e3b..a5a7df866 100644 --- a/frontend/src/app/main/ui/viewer/inspect/attributes/layout.cljs +++ b/frontend/src/app/main/ui/viewer/inspect/attributes/layout.cljs @@ -26,6 +26,8 @@ :align-content :justify-items :justify-content + :row-gap + :column-gap :gap :padding])