complex-utils
Advanced tools
+3
-0
| ### 2.8.8 | ||
| - fix:修正parseLayout函数在contentWidth<minWidth时的计算错误,以及size=1时的offset的错误计算 | ||
| ### 2.8.6/7 | ||
@@ -3,0 +6,0 @@ - feat:parseLayout添加边界判断函数isLayoutBoundary |
+1
-1
| { | ||
| "name": "complex-utils", | ||
| "version": "2.8.7", | ||
| "version": "2.8.8", | ||
| "description": "a complex utils", | ||
@@ -5,0 +5,0 @@ "main": "index.ts", |
@@ -28,2 +28,10 @@ | ||
| } { | ||
| if (contentWidth <= minWidth) { | ||
| // size小于0时的判断 | ||
| return { | ||
| width: minWidth, | ||
| offset: 0, | ||
| size: 1 | ||
| } | ||
| } | ||
| // 计算基于最小宽度和偏移量的元素数量,向下取整 | ||
@@ -37,3 +45,3 @@ const size = Math.floor((contentWidth + offset) / (minWidth + offset)) | ||
| // 重新计算偏移量,以均匀分布额外的空间 | ||
| offset = (contentWidth - width * size) / (size - 1) | ||
| offset = size > 1 ? (contentWidth - width * size) / (size - 1) : 0 | ||
| } | ||
@@ -40,0 +48,0 @@ // 返回计算出的宽度和数量 |
111555
0.26%3199
0.25%