mirror of
https://github.com/penpot/penpot.git
synced 2025-01-06 14:50:20 -05:00
Add context menu for opacity, rotation and stroke width
This commit is contained in:
parent
93c249c77a
commit
f10a4f28ea
1 changed files with 28 additions and 3 deletions
|
@ -162,11 +162,18 @@
|
|||
(defn apply-dimensions-token [{:keys [token-id token-type-props selected-shapes]} attributes]
|
||||
(let [token (dt/get-token-data-from-token-id token-id)
|
||||
attributes (set attributes)
|
||||
updated-token-type-props (if (set/superset? #{:x :y} attributes)
|
||||
updated-token-type-props (cond
|
||||
(set/superset? #{:x :y} attributes)
|
||||
(assoc token-type-props
|
||||
:on-update-shape update-shape-position
|
||||
:attributes attributes)
|
||||
token-type-props)]
|
||||
|
||||
(set/superset? #{:stroke-width} attributes)
|
||||
(assoc token-type-props
|
||||
:on-update-shape wtc/update-stroke-width
|
||||
:attributes attributes)
|
||||
|
||||
:else token-type-props)]
|
||||
(wtc/on-apply-token {:token token
|
||||
:token-type-props updated-token-type-props
|
||||
:selected-shapes selected-shapes})))
|
||||
|
@ -194,6 +201,12 @@
|
|||
:token-type-props updated-token-type-props
|
||||
:selected-shapes selected-shapes})))
|
||||
|
||||
(defn apply-rotation-opacity-stroke-token [{:keys [token-id token-type-props selected-shapes]} attributes]
|
||||
(let [token (dt/get-token-data-from-token-id token-id)]
|
||||
(wtc/on-apply-token {:token token
|
||||
:token-type-props token-type-props
|
||||
:selected-shapes selected-shapes})))
|
||||
|
||||
(defn additional-actions [{:keys [token-id token-type selected-shapes] :as context-data}]
|
||||
(let [attributes->actions (fn [update-fn coll]
|
||||
(for [{:keys [attributes] :as item} coll]
|
||||
|
@ -236,11 +249,23 @@
|
|||
[{:title "Spacing" :submenu :spacing}
|
||||
{:title "Sizing" :submenu :sizing}
|
||||
{:title "Border Radius" :submenu :border-radius}
|
||||
;; TODO: BORDER_WIDTH {:title "Border Width" :attributes #{:width} :children true}
|
||||
{:title "Border Width" :attributes #{:stroke-width}}
|
||||
{:title "x" :attributes #{:x}}
|
||||
{:title "y" :attributes #{:y}}])
|
||||
;;TODO: Background blur {:title "Background blur" :attributes #{:width}}])
|
||||
|
||||
:opacity (attributes->actions
|
||||
apply-rotation-opacity-stroke-token
|
||||
[{:title "opacity" :attributes #{:opacity}}])
|
||||
|
||||
:rotation (attributes->actions
|
||||
apply-rotation-opacity-stroke-token
|
||||
[{:title "rotation" :attributes #{:rotation}}])
|
||||
|
||||
:stroke-width (attributes->actions
|
||||
apply-rotation-opacity-stroke-token
|
||||
[{:title "stroke width" :attributes #{:stroke-width}}])
|
||||
|
||||
[])))
|
||||
|
||||
(defn generate-menu-entries [{:keys [token-id token-type-props token-type selected-shapes] :as context-data}]
|
||||
|
|
Loading…
Reference in a new issue