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 ### :boom: Breaking changes
### :sparkles: New features ### :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). - 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). - 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). - 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 ;; This `value` represents the previous value and is used as
;; initil value for the simple math expression evaluation. ;; 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 min-val (cond
(number? min-val-str) (number? min-val-str)
min-val-str min-val-str
(string? min-val-str) (string? min-val-str)
(d/parse-integer min-val-str)) (d/parse-double min-val-str))
max-val (cond max-val (cond
(number? max-val-str) (number? max-val-str)
max-val-str max-val-str
(string? max-val-str) (string? max-val-str)
(d/parse-integer max-val-str)) (d/parse-double max-val-str))
step-val (cond step-val (cond
(number? step-val-str) (number? step-val-str)
step-val-str step-val-str
(string? step-val-str) (string? step-val-str)
(d/parse-integer step-val-str) (d/parse-double step-val-str)
:else 1) :else 1)

View file

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

View file

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