0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 14:12:36 -05:00

Add single padding

This commit is contained in:
Florian Schroedl 2024-07-23 10:49:19 +02:00
parent 0e858d880d
commit 39822a3b31

View file

@ -305,30 +305,28 @@
:attributes vertical-attributes :attributes vertical-attributes
:on-update-shape on-update-shape)))] :on-update-shape on-update-shape)))]
(st/emit! event)))}] (st/emit! event)))}]
;; single-padding (->> padding-attrs single-padding-items (->> padding-attrs
;; (map (fn [[attr title]] (map (fn [[attr title]]
;; (let [selected? (selected-pred attr)] (let [same-axis-selected? (cond
;; {:title title (get horizontal-attributes attr) horizontal-padding-selected?
;; :selected? (and (not all-selected?) selected?) (get vertical-attributes attr) vertical-padding-selected?
;; :action #(let [props {:attributes #{attr} :else true)
;; :token token selected? (and
;; :shape-ids shape-ids} (not all-selected?)
;; event (cond (not same-axis-selected?)
;; all-selected? (-> (assoc props :attributes-to-remove all-padding-attrs) (selected-pred attr))]
;; (wtc/apply-token)) {:title title
;; selected? (wtc/unapply-token props) :selected? selected?
;; :else (-> (assoc props :on-update-shape wtc/update-shape-radius-single-corner) :action #(let [props {:attributes #{attr}
;; (wtc/apply-token)))] :token token
;; (st/emit! event))}))) :shape-ids shape-ids}
;; (into)) event (cond
;; all-padding (let [props {:attributes all-padding-attrs all-selected? (-> (assoc props :attributes-to-remove all-padding-attrs)
;; :token token (wtc/apply-token))
;; :shape-ids shape-ids}] selected? (wtc/unapply-token props)
;; {:title "All" :else (-> (assoc props :on-update-shape on-update-shape)
;; :selected? all-selected? (wtc/apply-token)))]
;; :action #(if all-selected? (st/emit! event))}))))
;; (st/emit! (wtc/unapply-token props))
;; (st/emit! (wtc/apply-token (assoc props :on-update-shape wtc/update-shape-radius-all))))})
gap-attrs (:gap spacing) gap-attrs (:gap spacing)
all-gap-attrs (into #{} (keys gap-attrs)) all-gap-attrs (into #{} (keys gap-attrs))
{:keys [all-selected? selected-pred shape-ids]} (attribute-actions token selected-shapes all-gap-attrs) {:keys [all-selected? selected-pred shape-ids]} (attribute-actions token selected-shapes all-gap-attrs)
@ -357,6 +355,7 @@
(st/emit! (wtc/unapply-token props)) (st/emit! (wtc/unapply-token props))
(st/emit! (wtc/apply-token (assoc props :on-update-shape wtc/update-shape-radius-all))))})] (st/emit! (wtc/apply-token (assoc props :on-update-shape wtc/update-shape-radius-all))))})]
(concat padding-items (concat padding-items
single-padding-items
[:separator] [:separator]
[all-gap] [all-gap]
single-gap))) single-gap)))