mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02: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]
|
[attrs]
|
||||||
(if-let [type (:stroke-type attrs)]
|
(if-let [type (:stroke-type attrs)]
|
||||||
(let [value (case type
|
(let [value (case type
|
||||||
:dotted "1,1"
|
:mixed "5,5,1,5"
|
||||||
:dashed "10,10")]
|
:dotted "5,5"
|
||||||
|
:dashed "10,10"
|
||||||
|
nil)]
|
||||||
|
(if value
|
||||||
(-> attrs
|
(-> attrs
|
||||||
(assoc! :stroke-dasharray value)
|
(assoc! :stroke-dasharray value)
|
||||||
(dissoc! :stroke-type)))
|
(dissoc! :stroke-type))
|
||||||
|
(dissoc! attrs :stroke-type)))
|
||||||
attrs))
|
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
|
(defn- extract-style-attrs
|
||||||
"Extract predefinet attrs from shapes."
|
"Extract predefinet attrs from shapes."
|
||||||
[shape]
|
[shape]
|
||||||
(let [attrs (select-keys shape +style-attrs+)]
|
(let [attrs (select-keys shape +style-attrs+)]
|
||||||
(-> (transient attrs)
|
(-> (transient attrs)
|
||||||
(transform-stroke-type)
|
(transform-stroke-attrs)
|
||||||
(persistent!))))
|
(persistent!))))
|
||||||
|
|
||||||
(defn- make-debug-attrs
|
(defn- make-debug-attrs
|
||||||
|
|
|
@ -88,16 +88,18 @@
|
||||||
[:span "Style"]
|
[:span "Style"]
|
||||||
[:div.row-flex
|
[:div.row-flex
|
||||||
[:select#style.input-select {:placeholder "Style"
|
[:select#style.input-select {:placeholder "Style"
|
||||||
|
:value (:stroke-type shape)
|
||||||
:on-change on-stroke-style-change}
|
:on-change on-stroke-style-change}
|
||||||
[:option {:value "nil"} "None"]
|
[:option {:value ":none"} "None"]
|
||||||
[:option {:value "nil"} "Solid"]
|
[:option {:value ":solid"} "Solid"]
|
||||||
[:option {:value ":dotted"} "Dotted"]
|
[:option {:value ":dotted"} "Dotted"]
|
||||||
[:option {:value ":dashed"} "Dashed"]]
|
[:option {:value ":dashed"} "Dashed"]
|
||||||
|
[:option {:value ":mixed"} "Mixed"]]
|
||||||
[:input#width.input-text
|
[:input#width.input-text
|
||||||
{:placeholder "Width"
|
{:placeholder "Width"
|
||||||
:type "number"
|
:type "number"
|
||||||
:min "0"
|
:min "0"
|
||||||
:value (:stroke-width shape "")
|
:value (:stroke-width shape "1")
|
||||||
:on-change on-width-change}]]
|
:on-change on-width-change}]]
|
||||||
|
|
||||||
;; SLIDEBAR FOR ROTATION AND OPACITY
|
;; SLIDEBAR FOR ROTATION AND OPACITY
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue