mirror of
https://github.com/penpot/penpot.git
synced 2025-01-11 01:10:28 -05:00
Simplify alignment related flags and its activation impl.
This commit is contained in:
parent
75a22381d2
commit
e77764f693
3 changed files with 11 additions and 16 deletions
|
@ -186,8 +186,11 @@
|
|||
:height c/viewport-height
|
||||
:x-axis (:grid/x-axis opts c/grid-x-axis)
|
||||
:y-axis (:grid/y-axis opts c/grid-y-axis)}]
|
||||
(rx/merge
|
||||
(->> (uw/send! worker message)
|
||||
(rx/map #(activate-flag :alignment/indexed))))))
|
||||
(rx/map #(activate-flag :grid/indexed)))
|
||||
(when (:grid/align opts)
|
||||
(rx/of (activate-flag :grid/alignment)))))))
|
||||
|
||||
(defn initialize-alignment-index
|
||||
[id]
|
||||
|
|
|
@ -38,19 +38,13 @@
|
|||
(-> (l/getter resolve-selected)
|
||||
(l/focus-atom st/state)))
|
||||
|
||||
;; (def ^:const ^:privae page-options-l
|
||||
;; (-> (l/key :options)
|
||||
;; (l/focus-atom wb/page-l)))
|
||||
|
||||
(def ^:const ^:private alignment-l
|
||||
(letfn [(getter [state]
|
||||
(let [{:keys [page flags]} (:workspace state)
|
||||
{:keys [options]} (get-in state [:pages-by-id page])]
|
||||
(and (contains? flags :alignment/indexed)
|
||||
(contains? flags :grid)
|
||||
(:grid/align options false))))]
|
||||
(letfn [(getter [flags]
|
||||
(and (contains? flags :grid/indexed)
|
||||
(contains? flags :grid/alignment)
|
||||
(contains? flags :grid)))]
|
||||
(-> (l/getter getter)
|
||||
(l/focus-atom st/state))))
|
||||
(l/focus-atom wb/flags-l))))
|
||||
|
||||
;; --- Public Api
|
||||
|
||||
|
@ -121,5 +115,3 @@
|
|||
[delta]
|
||||
(doseq [shape delta]
|
||||
(rs/emit! (uds/update-shape shape))))
|
||||
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
(on-align-change [event]
|
||||
(let [checked? (-> (dom/get-target event)
|
||||
(dom/checked?))]
|
||||
(swap! local assoc :grid/align checked?)))
|
||||
(swap! local assoc :grid/alignment checked?)))
|
||||
(on-submit [event]
|
||||
(dom/prevent-default event)
|
||||
(let [page (assoc page :options opts)]
|
||||
|
|
Loading…
Reference in a new issue