@quenty/radial-image 1.1.1 → 2.0.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 +11 -0
- package/package.json +6 -4
- package/src/Client/RadialImage.lua +78 -1
- package/src/Client/RadialImage.story.lua +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
# [2.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/radial-image@1.1.1...@quenty/radial-image@2.0.0) (2022-08-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Ensure radial image doesn't have weird clipping and add Blend API ([9b00487](https://github.com/Quenty/NevermoreEngine/commit/9b0048735a3fa1e7a012f4eebf1230caf6370f8d))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [1.1.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/radial-image@1.1.0...@quenty/radial-image@1.1.1) (2022-08-11)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/radial-image
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/radial-image",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Quenty's radial image system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -27,13 +27,15 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@quenty/baseobject": "^5.1.0",
|
|
30
|
-
"@quenty/blend": "^
|
|
30
|
+
"@quenty/blend": "^5.0.0",
|
|
31
31
|
"@quenty/loader": "^5.0.0",
|
|
32
32
|
"@quenty/maid": "^2.4.0",
|
|
33
|
-
"@quenty/math": "^2.2.0"
|
|
33
|
+
"@quenty/math": "^2.2.0",
|
|
34
|
+
"@quenty/rx": "^6.0.0",
|
|
35
|
+
"@quenty/valueobject": "^6.0.0"
|
|
34
36
|
},
|
|
35
37
|
"publishConfig": {
|
|
36
38
|
"access": "public"
|
|
37
39
|
},
|
|
38
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "dbb62609f980983cc32da90acfef13e30ed41113"
|
|
39
41
|
}
|
|
@@ -7,6 +7,9 @@ local require = require(script.Parent.loader).load(script)
|
|
|
7
7
|
local BaseObject = require("BaseObject")
|
|
8
8
|
local Blend = require("Blend")
|
|
9
9
|
local Math = require("Math")
|
|
10
|
+
local Observable = require("Observable")
|
|
11
|
+
local Maid = require("Maid")
|
|
12
|
+
local ValueObject = require("ValueObject")
|
|
10
13
|
|
|
11
14
|
local RadialImage = setmetatable({}, BaseObject)
|
|
12
15
|
RadialImage.ClassName = "RadialImage"
|
|
@@ -43,6 +46,9 @@ function RadialImage.new()
|
|
|
43
46
|
self._disabledColor.Value = Color3.new(1, 1, 1)
|
|
44
47
|
self._maid:GiveTask(self._disabledColor)
|
|
45
48
|
|
|
49
|
+
self._absoluteSize = ValueObject.new(Vector2.new(0, 0))
|
|
50
|
+
self._maid:GiveTask(self._absoluteSize)
|
|
51
|
+
|
|
46
52
|
self._maid:GiveTask(self:_render():Subscribe(function(gui)
|
|
47
53
|
self.Gui = gui
|
|
48
54
|
end))
|
|
@@ -50,6 +56,66 @@ function RadialImage.new()
|
|
|
50
56
|
return self
|
|
51
57
|
end
|
|
52
58
|
|
|
59
|
+
function RadialImage.blend(props)
|
|
60
|
+
assert(type(props) == "table", "Bad props")
|
|
61
|
+
|
|
62
|
+
return Observable.new(function(sub)
|
|
63
|
+
local maid = Maid.new()
|
|
64
|
+
|
|
65
|
+
local viewport = RadialImage.new()
|
|
66
|
+
|
|
67
|
+
local function bindObservable(propName, callback)
|
|
68
|
+
if props[propName] then
|
|
69
|
+
local observe = Blend.toPropertyObservable(props[propName])
|
|
70
|
+
if observe then
|
|
71
|
+
maid:GiveTask(observe:Subscribe(function(value)
|
|
72
|
+
callback(value)
|
|
73
|
+
end))
|
|
74
|
+
else
|
|
75
|
+
callback(props[propName])
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
bindObservable("Image", function(value)
|
|
81
|
+
viewport:SetImage(value)
|
|
82
|
+
end)
|
|
83
|
+
|
|
84
|
+
bindObservable("Percent", function(value)
|
|
85
|
+
viewport:SetPercent(value)
|
|
86
|
+
end)
|
|
87
|
+
bindObservable("EnabledTransparency", function(value)
|
|
88
|
+
viewport:SetEnabledTransparency(value)
|
|
89
|
+
end)
|
|
90
|
+
bindObservable("DisabledTransparency", function(value)
|
|
91
|
+
viewport:SetDisabledTransparency(value)
|
|
92
|
+
end)
|
|
93
|
+
bindObservable("EnabledColor", function(value)
|
|
94
|
+
viewport:SetEnabledColor(value)
|
|
95
|
+
end)
|
|
96
|
+
bindObservable("DisabledColor", function(value)
|
|
97
|
+
viewport:SetDisabledColor(value)
|
|
98
|
+
end)
|
|
99
|
+
bindObservable("Transparency", function(value)
|
|
100
|
+
viewport:SetTransparency(value)
|
|
101
|
+
end)
|
|
102
|
+
|
|
103
|
+
bindObservable("Size", function(value)
|
|
104
|
+
viewport.Gui.Size = value
|
|
105
|
+
end)
|
|
106
|
+
bindObservable("Position", function(value)
|
|
107
|
+
viewport.Gui.Position = value
|
|
108
|
+
end)
|
|
109
|
+
bindObservable("AnchorPoint", function(value)
|
|
110
|
+
viewport.Gui.AnchorPoint = value
|
|
111
|
+
end)
|
|
112
|
+
|
|
113
|
+
sub:Fire(viewport.Gui)
|
|
114
|
+
|
|
115
|
+
return maid
|
|
116
|
+
end)
|
|
117
|
+
end
|
|
118
|
+
|
|
53
119
|
--[=[
|
|
54
120
|
Sets the image to use for this radial image
|
|
55
121
|
@param image string
|
|
@@ -125,6 +191,7 @@ function RadialImage:_render()
|
|
|
125
191
|
Name = "RadialImage";
|
|
126
192
|
Size = UDim2.new(1, 0, 1, 0);
|
|
127
193
|
BackgroundTransparency = 1;
|
|
194
|
+
[Blend.OnChange("AbsoluteSize")] = self._absoluteSize;
|
|
128
195
|
|
|
129
196
|
[Blend.Children] = {
|
|
130
197
|
Blend.New "UIAspectRatioConstraint" {
|
|
@@ -133,7 +200,17 @@ function RadialImage:_render()
|
|
|
133
200
|
|
|
134
201
|
Blend.New "Frame" {
|
|
135
202
|
Name = "LeftFrame";
|
|
136
|
-
Size =
|
|
203
|
+
Size = Blend.Computed(self._absoluteSize, function(size)
|
|
204
|
+
-- hack: ensures when we're 24.5 wide or something we don't end
|
|
205
|
+
-- up with a split in the middle.
|
|
206
|
+
-- this is an issue because clips descendants tends towards floor
|
|
207
|
+
-- pixel clipping.
|
|
208
|
+
if size.x % 2 ~= 0 then
|
|
209
|
+
return UDim2.new(0.5, 1, 1, 0);
|
|
210
|
+
else
|
|
211
|
+
return UDim2.new(0.5, 0, 1, 0);
|
|
212
|
+
end
|
|
213
|
+
end);
|
|
137
214
|
Position = UDim2.new(0, 0, 0, 0);
|
|
138
215
|
BackgroundTransparency = 1;
|
|
139
216
|
ClipsDescendants = true;
|
|
@@ -21,7 +21,10 @@ return function(target)
|
|
|
21
21
|
maid:GiveTask(radialImage)
|
|
22
22
|
|
|
23
23
|
maid:GiveTask(RunService.RenderStepped:Connect(function()
|
|
24
|
-
radialImage:SetPercent((os.clock()/5) % 1)
|
|
24
|
+
-- radialImage:SetPercent((os.clock()/5) % 1)
|
|
25
|
+
|
|
26
|
+
local scale = (1 + math.sin((os.clock()/5)*math.pi*2))/2
|
|
27
|
+
radialImage.Gui.Size = UDim2.fromOffset(scale*90, scale*90)
|
|
25
28
|
end))
|
|
26
29
|
|
|
27
30
|
radialImage.Gui.Parent = target
|