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/snap.cljs b/frontend/src/app/main/snap.cljs index 374ec676b..5e8f14431 100644 --- a/frontend/src/app/main/snap.cljs +++ b/frontend/src/app/main/snap.cljs @@ -82,13 +82,14 @@ (defn get-snap-points [page-id frame-id remove-snap? zoom point coord] (let [value (get point coord) - vbox @refs/vbox] + 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 [[(- value (/ 0.5 zoom)) (+ value (/ 0.5 zoom))]]}) + :ranges ranges}) (rx/take 1) (rx/map (remove-from-snap-points remove-snap?))))) 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]) 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")} 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))) 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))