mirror of
https://github.com/penpot/penpot.git
synced 2025-05-22 13:26:43 +02:00
commit
8ea4e5ca10
6 changed files with 38 additions and 18 deletions
|
@ -176,7 +176,7 @@
|
||||||
(contains? event-types event-type))
|
(contains? event-types event-type))
|
||||||
|
|
||||||
(dm/assert!
|
(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)
|
(or (not= event-type :after-delay)
|
||||||
(cfh/frame-shape? shape)))
|
(cfh/frame-shape? shape)))
|
||||||
|
|
||||||
|
|
|
@ -82,13 +82,14 @@
|
||||||
|
|
||||||
(defn get-snap-points [page-id frame-id remove-snap? zoom point coord]
|
(defn get-snap-points [page-id frame-id remove-snap? zoom point coord]
|
||||||
(let [value (get 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
|
(->> (uw/ask! {:cmd :snaps/range-query
|
||||||
:page-id page-id
|
:page-id page-id
|
||||||
:frame-id frame-id
|
:frame-id frame-id
|
||||||
:axis coord
|
:axis coord
|
||||||
:bounds vbox
|
:bounds vbox
|
||||||
:ranges [[(- value (/ 0.5 zoom)) (+ value (/ 0.5 zoom))]]})
|
:ranges ranges})
|
||||||
(rx/take 1)
|
(rx/take 1)
|
||||||
(rx/map (remove-from-snap-points remove-snap?)))))
|
(rx/map (remove-from-snap-points remove-snap?)))))
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
:align-content
|
:align-content
|
||||||
:justify-items
|
:justify-items
|
||||||
:justify-content
|
:justify-content
|
||||||
|
:row-gap
|
||||||
|
:column-gap
|
||||||
:gap
|
:gap
|
||||||
:padding])
|
:padding])
|
||||||
|
|
||||||
|
|
|
@ -357,13 +357,14 @@
|
||||||
(update-interaction index #(ctsi/set-offset-effect % value)))))
|
(update-interaction index #(ctsi/set-offset-effect % value)))))
|
||||||
|
|
||||||
|
|
||||||
event-type-options [{:value :click :label (tr "workspace.options.interaction-on-click")}
|
event-type-options (-> [{:value :click :label (tr "workspace.options.interaction-on-click")}
|
||||||
;; TODO: need more UX research
|
;; TODO: need more UX research
|
||||||
;; :mouse-over (tr "workspace.options.interaction-while-hovering")
|
;; :mouse-over (tr "workspace.options.interaction-while-hovering")
|
||||||
;; :mouse-press (tr "workspace.options.interaction-while-pressing")
|
;; :mouse-press (tr "workspace.options.interaction-while-pressing")
|
||||||
{:value :mouse-enter :label (tr "workspace.options.interaction-mouse-enter")}
|
{:value :mouse-enter :label (tr "workspace.options.interaction-mouse-enter")}
|
||||||
{:value :mouse-leave :label (tr "workspace.options.interaction-mouse-leave")}
|
{:value :mouse-leave :label (tr "workspace.options.interaction-mouse-leave")}]
|
||||||
{:value :after-delay :label (tr "workspace.options.interaction-after-delay")}]
|
(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")}
|
action-type-options [{:value :navigate :label (tr "workspace.options.interaction-navigate-to")}
|
||||||
{:value :open-overlay :label (tr "workspace.options.interaction-open-overlay")}
|
{:value :open-overlay :label (tr "workspace.options.interaction-open-overlay")}
|
||||||
|
|
|
@ -291,7 +291,7 @@
|
||||||
(not (ctk/main-instance? obj))))
|
(not (ctk/main-instance? obj))))
|
||||||
|
|
||||||
;; Set with the elements to remove from the hover list
|
;; Set with the elements to remove from the hover list
|
||||||
remove-id-xf
|
remove-hover-xf
|
||||||
(cond
|
(cond
|
||||||
mod?
|
mod?
|
||||||
(filter grouped?)
|
(filter grouped?)
|
||||||
|
@ -306,8 +306,25 @@
|
||||||
(and (contains? #{:group :bool} (dm/get-in objects [% :type]))
|
(and (contains? #{:group :bool} (dm/get-in objects [% :type]))
|
||||||
(not (contains? child-parent? %)))))))
|
(not (contains? child-parent? %)))))))
|
||||||
|
|
||||||
remove-id?
|
remove-measure-xf
|
||||||
(into selected-with-parents remove-id-xf ids)
|
(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?
|
no-fill-nested-frames?
|
||||||
(fn [id]
|
(fn [id]
|
||||||
|
@ -318,7 +335,7 @@
|
||||||
|
|
||||||
hover-shape
|
hover-shape
|
||||||
(->> ids
|
(->> ids
|
||||||
(remove remove-id?)
|
(remove remove-hover?)
|
||||||
(remove (partial cfh/hidden-parent? objects))
|
(remove (partial cfh/hidden-parent? objects))
|
||||||
(remove #(and mod? (no-fill-nested-frames? %)))
|
(remove #(and mod? (no-fill-nested-frames? %)))
|
||||||
(filter #(or (empty? focus) (cpf/is-in-focus? objects focus %)))
|
(filter #(or (empty? focus) (cpf/is-in-focus? objects focus %)))
|
||||||
|
@ -329,14 +346,12 @@
|
||||||
measure-hover-shape
|
measure-hover-shape
|
||||||
(when show-measures?
|
(when show-measures?
|
||||||
(->> ids
|
(->> ids
|
||||||
(remove #(group-empty-space? % objects ids))
|
(remove remove-measure?)
|
||||||
(remove (partial cfh/hidden-parent? objects))
|
(remove (partial cfh/hidden-parent? objects))
|
||||||
(remove #(and mod? (no-fill-nested-frames? %)))
|
(remove #(and mod? (no-fill-nested-frames? %)))
|
||||||
(filter #(or (empty? focus) (cpf/is-in-focus? objects focus %)))
|
(filter #(or (empty? focus) (cpf/is-in-focus? objects focus %)))
|
||||||
(first)
|
(first)
|
||||||
(get objects)))]
|
(get objects)))]
|
||||||
|
|
||||||
|
|
||||||
(reset! hover hover-shape)
|
(reset! hover hover-shape)
|
||||||
(reset! measure-hover measure-hover-shape)
|
(reset! measure-hover measure-hover-shape)
|
||||||
(reset! hover-ids ids)))
|
(reset! hover-ids ids)))
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
[{:keys [page-id frame-id axis ranges bounds] :as message}]
|
[{:keys [page-id frame-id axis ranges bounds] :as message}]
|
||||||
(let [match-bounds?
|
(let [match-bounds?
|
||||||
(fn [[_ data]]
|
(fn [[_ data]]
|
||||||
(some #(grc/contains-point? bounds %) (map :pt data)))]
|
(some #(or (= :guide (:type %))
|
||||||
|
(grc/contains-point? bounds (:pt %))) data))]
|
||||||
(->> (into []
|
(->> (into []
|
||||||
(comp (mapcat #(sd/query @state page-id frame-id axis %))
|
(comp (mapcat #(sd/query @state page-id frame-id axis %))
|
||||||
(distinct))
|
(distinct))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue