mirror of
https://github.com/penpot/penpot.git
synced 2025-02-01 11:59:17 -05:00
Allow passing custom on-update-shape function
This commit is contained in:
parent
ededd23849
commit
9340ba9cc0
1 changed files with 7 additions and 5 deletions
|
@ -32,8 +32,10 @@
|
||||||
:shape-ids shape-ids
|
:shape-ids shape-ids
|
||||||
:selected-pred #(seq (% ids-by-attributes))}))
|
:selected-pred #(seq (% ids-by-attributes))}))
|
||||||
|
|
||||||
(defn generic-attribute-actions [attributes title {:keys [token selected-shapes]}]
|
(defn generic-attribute-actions [attributes title {:keys [token selected-shapes on-update-shape]}]
|
||||||
(let [{:keys [on-update-shape]} (wtty/get-token-properties token)
|
(let [on-update-shape-fn (or on-update-shape
|
||||||
|
(-> (wtty/get-token-properties token)
|
||||||
|
(:on-update-shape)))
|
||||||
{:keys [selected-pred shape-ids]} (attribute-actions token selected-shapes attributes)]
|
{:keys [selected-pred shape-ids]} (attribute-actions token selected-shapes attributes)]
|
||||||
(map (fn [attribute]
|
(map (fn [attribute]
|
||||||
(let [selected? (selected-pred attribute)
|
(let [selected? (selected-pred attribute)
|
||||||
|
@ -43,9 +45,9 @@
|
||||||
|
|
||||||
{:title title
|
{:title title
|
||||||
:selected? selected?
|
:selected? selected?
|
||||||
:action #(if selected?
|
:action (if selected?
|
||||||
(st/emit! (wtch/unapply-token props))
|
(st/emit! (wtch/unapply-token props))
|
||||||
(st/emit! (wtch/apply-token (assoc props :on-update-shape on-update-shape))))}))
|
(st/emit! (wtch/apply-token (assoc props :on-update-shape on-update-shape-fn))))}))
|
||||||
attributes)))
|
attributes)))
|
||||||
|
|
||||||
(defn all-or-sepearate-actions [{:keys [attribute-labels on-update-shape-all on-update-shape]}
|
(defn all-or-sepearate-actions [{:keys [attribute-labels on-update-shape-all on-update-shape]}
|
||||||
|
|
Loading…
Add table
Reference in a new issue