diff --git a/CHANGES.md b/CHANGES.md index c2bd44185..410eb0f4f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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). diff --git a/frontend/src/app/main/ui/components/numeric_input.cljs b/frontend/src/app/main/ui/components/numeric_input.cljs index 263a7a232..291b0db12 100644 --- a/frontend/src/app/main/ui/components/numeric_input.cljs +++ b/frontend/src/app/main/ui/components/numeric_input.cljs @@ -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) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs index fc87a2b3d..19978d164 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs @@ -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) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/stroke.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/stroke.cljs index a456a776a..bfd694809 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/stroke.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/stroke.cljs @@ -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}]]