@quenty/spring 10.2.0 → 10.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/default.project.json +1 -0
- package/package.json +4 -4
- package/src/Shared/SpringUtils.lua +16 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [10.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/spring@10.2.0...@quenty/spring@10.3.0) (2024-05-09)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Fix .package-lock.json replicating in packages ([75d0efe](https://github.com/Quenty/NevermoreEngine/commit/75d0efeef239f221d93352af71a5b3e930ec23c5))
|
|
12
|
+
* Fix UDim2 springs rounding with floating point errors ([f1bde79](https://github.com/Quenty/NevermoreEngine/commit/f1bde79376b9401de8e7383d203d448a05883de8))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
# [10.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/spring@10.1.1...@quenty/spring@10.2.0) (2024-04-27)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @quenty/spring
|
package/default.project.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/spring",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.3.0",
|
|
4
4
|
"description": "Spring implementation for Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@quenty/ducktype": "^5.
|
|
33
|
-
"@quenty/loader": "^10.
|
|
32
|
+
"@quenty/ducktype": "^5.3.0",
|
|
33
|
+
"@quenty/loader": "^10.3.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "3fd5cdca3128bf34c8d9dfae1e92d62533b6e6f5"
|
|
36
36
|
}
|
|
@@ -63,6 +63,20 @@ function SpringUtils.getVelocityAdjustment(velocity, dampen, speed)
|
|
|
63
63
|
return velocity*(2*dampen/speed)
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
+
local function convertUDim2(scaleX, offsetX, scaleY, offsetY)
|
|
67
|
+
-- Roblox UDim2.new(0, 9.999, 0, 9.999) rounds to UDim2.new(0, 9, 0, 9) which means small floating point
|
|
68
|
+
-- errors can cause shaking UI.
|
|
69
|
+
|
|
70
|
+
return UDim2.new(scaleX, math.round(offsetX), scaleY, math.round(offsetY))
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
local function convertUDim(scale, offset)
|
|
74
|
+
-- Roblox UDim.new(0, 9.999) rounds to UDim.new(0, 9) which means small floating point
|
|
75
|
+
-- errors can cause shaking UI.
|
|
76
|
+
|
|
77
|
+
return UDim.new(scale, math.round(offset))
|
|
78
|
+
end
|
|
79
|
+
|
|
66
80
|
--[=[
|
|
67
81
|
Converts an arbitrary value to a LinearValue if Roblox has not defined this value
|
|
68
82
|
for multiplication and addition.
|
|
@@ -74,9 +88,9 @@ function SpringUtils.toLinearIfNeeded(value)
|
|
|
74
88
|
if typeof(value) == "Color3" then
|
|
75
89
|
return LinearValue.new(Color3.new, {value.r, value.g, value.b})
|
|
76
90
|
elseif typeof(value) == "UDim2" then
|
|
77
|
-
return LinearValue.new(
|
|
91
|
+
return LinearValue.new(convertUDim2, {value.X.Scale, math.round(value.X.Offset), value.Y.Scale, math.round(value.Y.Offset)})
|
|
78
92
|
elseif typeof(value) == "UDim" then
|
|
79
|
-
return LinearValue.new(
|
|
93
|
+
return LinearValue.new(convertUDim, {value.Scale, math.round(value.Offset)})
|
|
80
94
|
else
|
|
81
95
|
return value
|
|
82
96
|
end
|