0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-13 16:21:57 -05:00

Allow decimals on stroke width and positions

This commit is contained in:
Pablo Alba 2022-01-17 12:26:22 +01:00 committed by Alonso Torres
parent bda97adf4f
commit d33542c4dc
4 changed files with 11 additions and 10 deletions

View file

@ -5,6 +5,7 @@
### :boom: Breaking changes
### :sparkles: New features
- Allow decimals on stroke width and positions [Taiga #2035](https://tree.taiga.io/project/penpot/issue/2035).
- Ability to ignore background when exporting an artboard [Taiga #1395](https://tree.taiga.io/project/penpot/us/1395).
- Show color hex or name on hover [Taiga #2413](https://tree.taiga.io/project/penpot/us/2413).
- Add shortcut to create artboard from selected objects [Taiga #2412](https://tree.taiga.io/project/penpot/us/2412).

View file

@ -51,28 +51,28 @@
;; This `value` represents the previous value and is used as
;; initil value for the simple math expression evaluation.
value (d/parse-integer value-str default-val)
value (d/parse-double value-str default-val)
min-val (cond
(number? min-val-str)
min-val-str
(string? min-val-str)
(d/parse-integer min-val-str))
(d/parse-double min-val-str))
max-val (cond
(number? max-val-str)
max-val-str
(string? max-val-str)
(d/parse-integer max-val-str))
(d/parse-double max-val-str))
step-val (cond
(number? step-val-str)
step-val-str
(string? step-val-str)
(d/parse-integer step-val-str)
(d/parse-double step-val-str)
:else 1)

View file

@ -199,13 +199,15 @@
:placeholder "--"
:on-click select-all
:on-change on-pos-x-change
:value (attr->string :x values)}]]
:value (attr->string :x values)
:precision 2}]]
[:div.input-element.Yaxis {:title (tr "workspace.options.y")}
[:> numeric-input {:no-validate true
:placeholder "--"
:on-click select-all
:on-change on-pos-y-change
:value (attr->string :y values)}]]])
:value (attr->string :y values)
:precision 2}]]])
;; ROTATION
(when (options :rotation)

View file

@ -8,7 +8,6 @@
(:require
[app.common.colors :as clr]
[app.common.data :as d]
[app.common.math :as math]
[app.common.pages.spec :as spec]
[app.main.data.workspace.changes :as dch]
[app.main.data.workspace.colors :as dc]
@ -37,9 +36,7 @@
(defn- width->string [width]
(if (= width :multiple)
""
(str (-> width
(d/coalesce 1)
(math/round)))))
(str (or width 1))))
(defn- enum->string [value]
(if (= value :multiple)
@ -210,6 +207,7 @@
[:> numeric-input
{:min 0
:value (-> (:stroke-width values) width->string)
:precision 2
:placeholder (tr "settings.multiple")
:on-change on-stroke-width-change}]]