mirror of
https://github.com/penpot/penpot.git
synced 2025-02-13 10:38:13 -05:00
Add correct stroke styles and fix wrong behavior.
This commit is contained in:
parent
91551044d0
commit
9d498dfaf9
2 changed files with 23 additions and 11 deletions
|
@ -63,19 +63,29 @@
|
|||
[attrs]
|
||||
(if-let [type (:stroke-type attrs)]
|
||||
(let [value (case type
|
||||
:dotted "1,1"
|
||||
:dashed "10,10")]
|
||||
(-> attrs
|
||||
(assoc! :stroke-dasharray value)
|
||||
(dissoc! :stroke-type)))
|
||||
:mixed "5,5,1,5"
|
||||
:dotted "5,5"
|
||||
:dashed "10,10"
|
||||
nil)]
|
||||
(if value
|
||||
(-> attrs
|
||||
(assoc! :stroke-dasharray value)
|
||||
(dissoc! :stroke-type))
|
||||
(dissoc! attrs :stroke-type)))
|
||||
attrs))
|
||||
|
||||
(defn- transform-stroke-attrs
|
||||
[attrs]
|
||||
(if (= (:stroke-type attrs :none) :none)
|
||||
(dissoc! attrs :stroke-type :stroke-width :stroke-opacity :stroke)
|
||||
(transform-stroke-type attrs)))
|
||||
|
||||
(defn- extract-style-attrs
|
||||
"Extract predefinet attrs from shapes."
|
||||
[shape]
|
||||
(let [attrs (select-keys shape +style-attrs+)]
|
||||
(-> (transient attrs)
|
||||
(transform-stroke-type)
|
||||
(transform-stroke-attrs)
|
||||
(persistent!))))
|
||||
|
||||
(defn- make-debug-attrs
|
||||
|
|
|
@ -88,16 +88,18 @@
|
|||
[:span "Style"]
|
||||
[:div.row-flex
|
||||
[:select#style.input-select {:placeholder "Style"
|
||||
:on-change on-stroke-style-change}
|
||||
[:option {:value "nil"} "None"]
|
||||
[:option {:value "nil"} "Solid"]
|
||||
:value (:stroke-type shape)
|
||||
:on-change on-stroke-style-change}
|
||||
[:option {:value ":none"} "None"]
|
||||
[:option {:value ":solid"} "Solid"]
|
||||
[:option {:value ":dotted"} "Dotted"]
|
||||
[:option {:value ":dashed"} "Dashed"]]
|
||||
[:option {:value ":dashed"} "Dashed"]
|
||||
[:option {:value ":mixed"} "Mixed"]]
|
||||
[:input#width.input-text
|
||||
{:placeholder "Width"
|
||||
:type "number"
|
||||
:min "0"
|
||||
:value (:stroke-width shape "")
|
||||
:value (:stroke-width shape "1")
|
||||
:on-change on-width-change}]]
|
||||
|
||||
;; SLIDEBAR FOR ROTATION AND OPACITY
|
||||
|
|
Loading…
Add table
Reference in a new issue