mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 00:10:11 -05:00
commit
8ea4e5ca10
6 changed files with 38 additions and 18 deletions
|
@ -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)))
|
||||
|
||||
|
|
|
@ -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?)))))
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
:align-content
|
||||
:justify-items
|
||||
:justify-content
|
||||
:row-gap
|
||||
:column-gap
|
||||
:gap
|
||||
:padding])
|
||||
|
||||
|
|
|
@ -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")}
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue