0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-12 07:41:43 -05:00

🐛 Make the width and height min value to 1px.

This commit is contained in:
Andrey Antukh 2020-11-30 13:50:38 +01:00 committed by Hirunatan
parent 3db9907c25
commit e73a8a2f7e
2 changed files with 29 additions and 32 deletions

View file

@ -20,6 +20,7 @@
[app.main.data.workspace :as udw] [app.main.data.workspace :as udw]
[app.main.ui.icons :as i] [app.main.ui.icons :as i]
[app.main.ui.components.dropdown :refer [dropdown]] [app.main.ui.components.dropdown :refer [dropdown]]
[app.main.ui.components.numeric-input :refer [numeric-input]]
[app.main.ui.workspace.sidebar.options.fill :refer [fill-attrs fill-menu]] [app.main.ui.workspace.sidebar.options.fill :refer [fill-attrs fill-menu]]
[app.main.ui.workspace.sidebar.options.stroke :refer [stroke-attrs stroke-menu]] [app.main.ui.workspace.sidebar.options.stroke :refer [stroke-attrs stroke-menu]]
[app.main.ui.workspace.sidebar.options.frame-grid :refer [frame-grid]] [app.main.ui.workspace.sidebar.options.frame-grid :refer [frame-grid]]
@ -51,7 +52,7 @@
(fn [event attr] (fn [event attr]
(let [value (-> (dom/get-target event) (let [value (-> (dom/get-target event)
(dom/get-value) (dom/get-value)
(d/parse-integer 0))] (d/parse-integer 1))]
(st/emit! (udw/update-dimensions [(:id shape)] attr value)))) (st/emit! (udw/update-dimensions [(:id shape)] attr value))))
on-proportion-lock-change on-proportion-lock-change
@ -104,38 +105,34 @@
i/lock i/lock
i/unlock)] i/unlock)]
[:div.input-element.pixels [:div.input-element.pixels
[:input.input-text {:type "number" [:> numeric-input {:min "1"
:min "0"
:on-click select-all :on-click select-all
:on-change on-width-change :on-change on-width-change
:value (-> (:width shape) :value (-> (:width shape)
(math/precision 2) (math/precision 2)
(d/coalesce-str "0"))}]] (d/coalesce-str "1"))}]]
[:div.input-element.pixels [:div.input-element.pixels
[:input.input-text {:type "number" [:> numeric-input {:min "1"
:min "0"
:on-click select-all :on-click select-all
:on-change on-height-change :on-change on-height-change
:value (-> (:height shape) :value (-> (:height shape)
(math/precision 2) (math/precision 2)
(d/coalesce-str "0"))}]]] (d/coalesce-str "1"))}]]]
;; POSITION ;; POSITION
[:div.row-flex [:div.row-flex
[:span.element-set-subtitle (tr "workspace.options.position")] [:span.element-set-subtitle (tr "workspace.options.position")]
[:div.input-element.pixels [:div.input-element.pixels
[:input.input-text {:placeholder "x" [:> numeric-input {:placeholder "x"
:type "number"
:on-click select-all :on-click select-all
:on-change on-pos-x-change :on-change on-pos-x-change
:value (-> (:x shape) :value (-> (:x shape)
(math/precision 2) (math/precision 2)
(d/coalesce-str "0"))}]] (d/coalesce-str "0"))}]]
[:div.input-element.pixels [:div.input-element.pixels
[:input.input-text {:placeholder "y" [:> numeric-input {:placeholder "y"
:type "number"
:on-click select-all :on-click select-all
:on-change on-pos-y-change :on-change on-pos-y-change
:value (-> (:y shape) :value (-> (:y shape)

View file

@ -60,7 +60,7 @@
(fn [event attr] (fn [event attr]
(let [value (-> (dom/get-target event) (let [value (-> (dom/get-target event)
(dom/get-value) (dom/get-value)
(d/parse-integer 0))] (d/parse-integer 1))]
(st/emit! (udw/update-dimensions ids attr value)))) (st/emit! (udw/update-dimensions ids attr value))))
on-proportion-lock-change on-proportion-lock-change
@ -120,7 +120,7 @@
[:div.row-flex [:div.row-flex
[:span.element-set-subtitle (t locale "workspace.options.size")] [:span.element-set-subtitle (t locale "workspace.options.size")]
[:div.input-element.width [:div.input-element.width
[:> numeric-input {:min "0" [:> numeric-input {:min "1"
:no-validate true :no-validate true
:placeholder "--" :placeholder "--"
:on-click select-all :on-click select-all
@ -128,7 +128,7 @@
:value (attr->string :width values)}]] :value (attr->string :width values)}]]
[:div.input-element.height [:div.input-element.height
[:> numeric-input {:min "0" [:> numeric-input {:min "1"
:no-validate true :no-validate true
:placeholder "--" :placeholder "--"
:on-click select-all :on-click select-all