0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-27 01:06:30 -05:00

Merge pull request #1820 from penpot/palba-handoff-size-round-two-decimals

🐛 Round the size values on handoff to two decimals
This commit is contained in:
Andrey Antukh 2022-04-20 09:11:10 +02:00 committed by GitHub
commit 121b5af5d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 10 deletions

View file

@ -49,6 +49,7 @@
### :bug: Bugs fixed ### :bug: Bugs fixed
- Round the size values on handoff to two decimals [Taiga #3227](https://tree.taiga.io/project/penpot/issue/3227)
- Fix hidden file name on import [Taiga #3172](https://tree.taiga.io/project/penpot/issue/3172) - Fix hidden file name on import [Taiga #3172](https://tree.taiga.io/project/penpot/issue/3172)
- Fix unneccessary scrollbars at the color list [Taiga #3211](https://tree.taiga.io/project/penpot/issue/3211) - Fix unneccessary scrollbars at the color list [Taiga #3211](https://tree.taiga.io/project/penpot/issue/3211)
- "Show in exports" is showing in multiselections [Taiga #3194](https://tree.taiga.io/project/penpot/issue/3194) - "Show in exports" is showing in multiselections [Taiga #3194](https://tree.taiga.io/project/penpot/issue/3194)

View file

@ -10,6 +10,7 @@
[app.main.ui.components.copy-button :refer [copy-button]] [app.main.ui.components.copy-button :refer [copy-button]]
[app.util.code-gen :as cg] [app.util.code-gen :as cg]
[app.util.i18n :refer [tr]] [app.util.i18n :refer [tr]]
[app.util.strings :as ust]
[cuerdas.core :as str] [cuerdas.core :as str]
[rumext.alpha :as mf])) [rumext.alpha :as mf]))
@ -38,46 +39,46 @@
[:* [:*
[:div.attributes-unit-row [:div.attributes-unit-row
[:div.attributes-label (tr "handoff.attributes.layout.width")] [:div.attributes-label (tr "handoff.attributes.layout.width")]
[:div.attributes-value width "px"] [:div.attributes-value (ust/format-precision width 2) "px"]
[:& copy-button {:data (copy-data selrect :width)}]] [:& copy-button {:data (copy-data selrect :width)}]]
[:div.attributes-unit-row [:div.attributes-unit-row
[:div.attributes-label (tr "handoff.attributes.layout.height")] [:div.attributes-label (tr "handoff.attributes.layout.height")]
[:div.attributes-value height "px"] [:div.attributes-value (ust/format-precision height 2) "px"]
[:& copy-button {:data (copy-data selrect :height)}]] [:& copy-button {:data (copy-data selrect :height)}]]
(when (not= (:x shape) 0) (when (not= (:x shape) 0)
[:div.attributes-unit-row [:div.attributes-unit-row
[:div.attributes-label (tr "handoff.attributes.layout.left")] [:div.attributes-label (tr "handoff.attributes.layout.left")]
[:div.attributes-value x "px"] [:div.attributes-value (ust/format-precision x 2) "px"]
[:& copy-button {:data (copy-data selrect :x)}]]) [:& copy-button {:data (copy-data selrect :x)}]])
(when (not= (:y shape) 0) (when (not= (:y shape) 0)
[:div.attributes-unit-row [:div.attributes-unit-row
[:div.attributes-label (tr "handoff.attributes.layout.top")] [:div.attributes-label (tr "handoff.attributes.layout.top")]
[:div.attributes-value y "px"] [:div.attributes-value (ust/format-precision y 2) "px"]
[:& copy-button {:data (copy-data selrect :y)}]]) [:& copy-button {:data (copy-data selrect :y)}]])
(when (ctr/radius-1? shape) (when (ctr/radius-1? shape)
[:div.attributes-unit-row [:div.attributes-unit-row
[:div.attributes-label (tr "handoff.attributes.layout.radius")] [:div.attributes-label (tr "handoff.attributes.layout.radius")]
[:div.attributes-value (:rx shape 0) "px"] [:div.attributes-value (ust/format-precision (:rx shape 0) 2) "px"]
[:& copy-button {:data (copy-data shape :rx)}]]) [:& copy-button {:data (copy-data shape :rx)}]])
(when (ctr/radius-4? shape) (when (ctr/radius-4? shape)
[:div.attributes-unit-row [:div.attributes-unit-row
[:div.attributes-label (tr "handoff.attributes.layout.radius")] [:div.attributes-label (tr "handoff.attributes.layout.radius")]
[:div.attributes-value [:div.attributes-value
(:r1 shape) ", " (ust/format-precision (:r1 shape) 2) ", "
(:r2 shape) ", " (ust/format-precision (:r2 shape) 2) ", "
(:r3 shape) ", " (ust/format-precision (:r3 shape) 2) ", "
(:r4 shape) "px"] (ust/format-precision (:r4 shape) 2) "px"]
[:& copy-button {:data (copy-data shape :r1)}]]) [:& copy-button {:data (copy-data shape :r1)}]])
(when (not= (:rotation shape 0) 0) (when (not= (:rotation shape 0) 0)
[:div.attributes-unit-row [:div.attributes-unit-row
[:div.attributes-label (tr "handoff.attributes.layout.rotation")] [:div.attributes-label (tr "handoff.attributes.layout.rotation")]
[:div.attributes-value (:rotation shape) "deg"] [:div.attributes-value (ust/format-precision (:rotation shape) 2) "deg"]
[:& copy-button {:data (copy-data shape :rotation)}]])])) [:& copy-button {:data (copy-data shape :rotation)}]])]))