0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 14:39:45 -05:00

🐛 Fix precision for wrap in flex

This commit is contained in:
alonso.torres 2023-03-29 16:50:21 +02:00
parent af428ab0ae
commit 0c8d8d92ba
3 changed files with 9 additions and 4 deletions

View file

@ -73,6 +73,7 @@
- Fix last update project timer update after creating new file [Taiga #5096](https://tree.taiga.io/project/penpot/issue/5096)
- Fix dashboard scrolling using 'Page Up' and 'Page Down' [Taiga #5081](https://tree.taiga.io/project/penpot/issue/5081)
- Fix view mode header buttons overlapping in small resolutions [Taiga #5058](https://tree.taiga.io/project/penpot/issue/5058)
- Fix precision for wrap in flex [Taiga #5072](https://tree.taiga.io/project/penpot/issue/5072)
### :heart: Community contributions by (Thank you!)
- To @ondrejkonec: for contributing to the code with:

View file

@ -104,8 +104,10 @@
(if (and (some? line-data)
(or (not wrap?)
(and row? (<= next-line-min-width layout-width))
(and col? (<= next-line-min-height layout-height))))
(and row? (or (< next-line-min-width layout-width)
(mth/close? next-line-min-width layout-width 0.5)))
(and col? (or (< next-line-min-height layout-height)
(mth/close? next-line-min-height layout-height 0.5)))))
(recur {:line-min-width (if row? (+ line-min-width next-min-width) (max line-min-width next-min-width))
:line-max-width (if row? (+ line-max-width next-max-width) (max line-max-width next-max-width))

View file

@ -185,8 +185,10 @@
(defn close?
"Equality for float numbers. Check if the difference is within a range"
[num1 num2]
(<= (abs (- num1 num2)) float-equal-precision))
([num1 num2]
(close? num1 num2 float-equal-precision))
([num1 num2 precision]
(<= (abs (- num1 num2)) precision)))
(defn lerp
"Calculates a the linear interpolation between two values and a given percent"