@quenty/colorpicker 4.19.0 → 4.20.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 +13 -0
- package/package.json +9 -8
- package/src/Client/Cursor/ColorPickerCursorPreview.lua +9 -12
- package/src/Client/Cursor/ColorPickerTriangle.lua +9 -8
- package/src/Client/Cursor/HSColorPickerCursor.lua +10 -14
- package/src/Client/HSV/HSColorPicker.lua +10 -7
- package/src/Client/HSV/HSVColorPicker.lua +11 -9
- package/src/Client/HSV/ValueColorPicker.lua +12 -14
- package/src/Client/Input/ColorPickerInput.lua +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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
|
+
# [4.20.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpicker@4.19.0...@quenty/colorpicker@4.20.0) (2023-05-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Convert ColorPicker to ValueObject instead of Roblox instnaces for viewmodel ([8f59d5e](https://github.com/Quenty/NevermoreEngine/commit/8f59d5e032acf47db5df4fb07ce4b8e0acfc8354))
|
|
12
|
+
* Initial refactor of guis to use ValueObject instead of ValueObject ([723aba0](https://github.com/Quenty/NevermoreEngine/commit/723aba0208cae7e06c9d8bf2d8f0092d042d70ea))
|
|
13
|
+
* Upgrade to ValueObject and measure values ([83235f7](https://github.com/Quenty/NevermoreEngine/commit/83235f77b7b4f515eac40b16ef1fd230a0c877e7))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
6
19
|
# [4.19.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpicker@4.18.0...@quenty/colorpicker@4.19.0) (2023-05-08)
|
|
7
20
|
|
|
8
21
|
**Note:** Version bump only for package @quenty/colorpicker
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/colorpicker",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.20.0",
|
|
4
4
|
"description": "Color picking UI system for Roblox.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -29,14 +29,15 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@quenty/baseobject": "^6.2.1",
|
|
32
|
-
"@quenty/basicpane": "^7.
|
|
33
|
-
"@quenty/blend": "^6.
|
|
34
|
-
"@quenty/color3utils": "^5.
|
|
35
|
-
"@quenty/inputobjectutils": "^4.
|
|
36
|
-
"@quenty/instanceutils": "^7.
|
|
32
|
+
"@quenty/basicpane": "^7.14.0",
|
|
33
|
+
"@quenty/blend": "^6.18.0",
|
|
34
|
+
"@quenty/color3utils": "^5.19.0",
|
|
35
|
+
"@quenty/inputobjectutils": "^4.1.0",
|
|
36
|
+
"@quenty/instanceutils": "^7.14.0",
|
|
37
37
|
"@quenty/loader": "^6.2.1",
|
|
38
38
|
"@quenty/maid": "^2.5.0",
|
|
39
|
-
"@quenty/math": "^2.3.0"
|
|
39
|
+
"@quenty/math": "^2.3.0",
|
|
40
|
+
"@quenty/valueobject": "^7.14.0"
|
|
40
41
|
},
|
|
41
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "11058e90e51ea83d3dad6ae9abe59cc19c36b94b"
|
|
42
43
|
}
|
|
@@ -11,6 +11,7 @@ local BasicPaneUtils = require("BasicPaneUtils")
|
|
|
11
11
|
local Math = require("Math")
|
|
12
12
|
local ColorPickerUtils = require("ColorPickerUtils")
|
|
13
13
|
local LuvColor3Utils = require("LuvColor3Utils")
|
|
14
|
+
local ValueObject = require("ValueObject")
|
|
14
15
|
|
|
15
16
|
local ColorPickerCursorPreview = setmetatable({}, BasicPane)
|
|
16
17
|
ColorPickerCursorPreview.ClassName = "ColorPickerCursorPreview"
|
|
@@ -19,28 +20,22 @@ ColorPickerCursorPreview.__index = ColorPickerCursorPreview
|
|
|
19
20
|
function ColorPickerCursorPreview.new()
|
|
20
21
|
local self = setmetatable(BasicPane.new(), ColorPickerCursorPreview)
|
|
21
22
|
|
|
22
|
-
self._backgroundColorHint =
|
|
23
|
-
self._backgroundColorHint.Value = Color3.new(0, 0, 0)
|
|
23
|
+
self._backgroundColorHint = ValueObject.new(Color3.new(0, 0, 0), "Color3")
|
|
24
24
|
self._maid:GiveTask(self._backgroundColorHint)
|
|
25
25
|
|
|
26
|
-
self._heightAbs =
|
|
27
|
-
self._heightAbs.Value = 60
|
|
26
|
+
self._heightAbs = ValueObject.new(60, "number")
|
|
28
27
|
self._maid:GiveTask(self._heightAbs)
|
|
29
28
|
|
|
30
|
-
self._offsetAbs =
|
|
31
|
-
self._offsetAbs.Value = -20
|
|
29
|
+
self._offsetAbs = ValueObject.new(-20, "number")
|
|
32
30
|
self._maid:GiveTask(self._offsetAbs)
|
|
33
31
|
|
|
34
|
-
self._position =
|
|
35
|
-
self._position.Value = Vector3.new(0, 0, 0)
|
|
32
|
+
self._position = ValueObject.new(Vector2.zero, "Vector2")
|
|
36
33
|
self._maid:GiveTask(self._position)
|
|
37
34
|
|
|
38
|
-
self._transparency =
|
|
39
|
-
self._transparency.Value = 0
|
|
35
|
+
self._transparency = ValueObject.new(0, "number")
|
|
40
36
|
self._maid:GiveTask(self._transparency)
|
|
41
37
|
|
|
42
|
-
self._colorValue =
|
|
43
|
-
self._colorValue.Value = Color3.new(0, 0, 0)
|
|
38
|
+
self._colorValue = ValueObject.new(Color3.new(0, 0, 0), "Color3")
|
|
44
39
|
self._maid:GiveTask(self._colorValue)
|
|
45
40
|
|
|
46
41
|
self._maid:GiveTask(self:_render():Subscribe(function(gui)
|
|
@@ -59,6 +54,8 @@ function ColorPickerCursorPreview:HintBackgroundColor(color)
|
|
|
59
54
|
end
|
|
60
55
|
|
|
61
56
|
function ColorPickerCursorPreview:SetPosition(position)
|
|
57
|
+
assert(typeof(position) == "Vector2", "Bad position")
|
|
58
|
+
|
|
62
59
|
self._position.Value = position
|
|
63
60
|
end
|
|
64
61
|
|
|
@@ -7,6 +7,7 @@ local require = require(script.Parent.loader).load(script)
|
|
|
7
7
|
local BaseObject = require("BaseObject")
|
|
8
8
|
local Blend = require("Blend")
|
|
9
9
|
local ColorPickerUtils = require("ColorPickerUtils")
|
|
10
|
+
local ValueObject = require("ValueObject")
|
|
10
11
|
|
|
11
12
|
local ColorPickerTriangle = setmetatable({}, BaseObject)
|
|
12
13
|
ColorPickerTriangle.ClassName = "ColorPickerTriangle"
|
|
@@ -15,20 +16,16 @@ ColorPickerTriangle.__index = ColorPickerTriangle
|
|
|
15
16
|
function ColorPickerTriangle.new()
|
|
16
17
|
local self = setmetatable(BaseObject.new(), ColorPickerTriangle)
|
|
17
18
|
|
|
18
|
-
self._transparency =
|
|
19
|
-
self._transparency.Value = 0
|
|
19
|
+
self._transparency = ValueObject.new(0, "number")
|
|
20
20
|
self._maid:GiveTask(self._transparency)
|
|
21
21
|
|
|
22
|
-
self._backgroundColorHint =
|
|
23
|
-
self._backgroundColorHint.Value = Color3.new(0, 0, 0)
|
|
22
|
+
self._backgroundColorHint = ValueObject.new(Color3.new(0, 0, 0), "Color3")
|
|
24
23
|
self._maid:GiveTask(self._backgroundColorHint)
|
|
25
24
|
|
|
26
|
-
self._color =
|
|
27
|
-
self._color.Value = Color3.new(1, 1, 1)
|
|
25
|
+
self._color = ValueObject.new(Color3.new(1, 1, 1), "Color3")
|
|
28
26
|
self._maid:GiveTask(self._color)
|
|
29
27
|
|
|
30
|
-
self._sizeValue =
|
|
31
|
-
self._sizeValue.Value = Vector3.new(0.05, 0.1, 0)
|
|
28
|
+
self._sizeValue = ValueObject.new(Vector2.new(0.05, 0.1), "Vector2")
|
|
32
29
|
self._maid:GiveTask(self._sizeValue)
|
|
33
30
|
|
|
34
31
|
self._maid:GiveTask(self:_render():Subscribe(function(gui)
|
|
@@ -46,6 +43,10 @@ function ColorPickerTriangle:GetSizeValue()
|
|
|
46
43
|
return self._sizeValue
|
|
47
44
|
end
|
|
48
45
|
|
|
46
|
+
function ColorPickerTriangle:GetMeasureValue()
|
|
47
|
+
return self._sizeValue
|
|
48
|
+
end
|
|
49
|
+
|
|
49
50
|
function ColorPickerTriangle:SetColor(color)
|
|
50
51
|
self._color.Value = color
|
|
51
52
|
end
|
|
@@ -9,6 +9,7 @@ local require = require(script.Parent.loader).load(script)
|
|
|
9
9
|
local BaseObject = require("BaseObject")
|
|
10
10
|
local Blend = require("Blend")
|
|
11
11
|
local ColorPickerUtils = require("ColorPickerUtils")
|
|
12
|
+
local ValueObject = require("ValueObject")
|
|
12
13
|
|
|
13
14
|
local HSColorPickerCursor = setmetatable({}, BaseObject)
|
|
14
15
|
HSColorPickerCursor.ClassName = "HSColorPickerCursor"
|
|
@@ -17,32 +18,25 @@ HSColorPickerCursor.__index = HSColorPickerCursor
|
|
|
17
18
|
function HSColorPickerCursor.new()
|
|
18
19
|
local self = setmetatable(BaseObject.new(), HSColorPickerCursor)
|
|
19
20
|
|
|
20
|
-
self._backgroundColorHint =
|
|
21
|
-
self._backgroundColorHint.Value = Color3.new(0, 0, 0)
|
|
21
|
+
self._backgroundColorHint = ValueObject.new(Color3.new(0, 0, 0), "Color3")
|
|
22
22
|
self._maid:GiveTask(self._backgroundColorHint)
|
|
23
23
|
|
|
24
|
-
self._height =
|
|
25
|
-
self._height.Value = 0.075
|
|
24
|
+
self._height = ValueObject.new(0.075, "number")
|
|
26
25
|
self._maid:GiveTask(self._height)
|
|
27
26
|
|
|
28
|
-
self._crossHairWidthAbs =
|
|
29
|
-
self._crossHairWidthAbs.Value = 1
|
|
27
|
+
self._crossHairWidthAbs = ValueObject.new(1, "number")
|
|
30
28
|
self._maid:GiveTask(self._crossHairWidthAbs)
|
|
31
29
|
|
|
32
|
-
self._verticalHairVisible =
|
|
33
|
-
self._verticalHairVisible.Value = true
|
|
30
|
+
self._verticalHairVisible = ValueObject.new(true, "boolean")
|
|
34
31
|
self._maid:GiveTask(self._verticalHairVisible)
|
|
35
32
|
|
|
36
|
-
self._horizontalHairVisible =
|
|
37
|
-
self._horizontalHairVisible.Value = true
|
|
33
|
+
self._horizontalHairVisible = ValueObject.new(true, "boolean")
|
|
38
34
|
self._maid:GiveTask(self._horizontalHairVisible)
|
|
39
35
|
|
|
40
|
-
self._position =
|
|
41
|
-
self._position.Value = Vector3.new(0, 0, 0)
|
|
36
|
+
self._position = ValueObject.new(Vector2.zero, "Vector2")
|
|
42
37
|
self._maid:GiveTask(self._position)
|
|
43
38
|
|
|
44
|
-
self._transparency =
|
|
45
|
-
self._transparency.Value = 0
|
|
39
|
+
self._transparency = ValueObject.new(0, "number")
|
|
46
40
|
self._maid:GiveTask(self._transparency)
|
|
47
41
|
|
|
48
42
|
self._maid:GiveTask(self:_render():Subscribe(function(gui)
|
|
@@ -88,6 +82,8 @@ end
|
|
|
88
82
|
@param position Vector2
|
|
89
83
|
]=]
|
|
90
84
|
function HSColorPickerCursor:SetPosition(position)
|
|
85
|
+
assert(typeof(position) == "Vector2", "Bad position")
|
|
86
|
+
|
|
91
87
|
self._position.Value = position
|
|
92
88
|
end
|
|
93
89
|
|
|
@@ -12,6 +12,7 @@ local Blend = require("Blend")
|
|
|
12
12
|
local ColorPickerCursorPreview = require("ColorPickerCursorPreview")
|
|
13
13
|
local ColorPickerInput = require("ColorPickerInput")
|
|
14
14
|
local HSColorPickerCursor = require("HSColorPickerCursor")
|
|
15
|
+
local ValueObject = require("ValueObject")
|
|
15
16
|
|
|
16
17
|
local HSColorPicker = setmetatable({}, BaseObject)
|
|
17
18
|
HSColorPicker.ClassName = "HSColorPicker"
|
|
@@ -21,17 +22,15 @@ function HSColorPicker.new()
|
|
|
21
22
|
local self = setmetatable(BaseObject.new(), HSColorPicker)
|
|
22
23
|
|
|
23
24
|
self._hsvColorValue = Instance.new("Vector3Value")
|
|
24
|
-
self._hsvColorValue.Value = Vector3.
|
|
25
|
+
self._hsvColorValue.Value = Vector3.zero
|
|
25
26
|
self._maid:GiveTask(self._hsvColorValue)
|
|
26
27
|
|
|
27
28
|
self.ColorChanged = self._hsvColorValue.Changed
|
|
28
29
|
|
|
29
|
-
self._sizeValue =
|
|
30
|
-
self._sizeValue.Value = Vector3.new(4, 4, 0)
|
|
30
|
+
self._sizeValue = ValueObject.new(Vector2.new(4, 4), "Vector2")
|
|
31
31
|
self._maid:GiveTask(self._sizeValue)
|
|
32
32
|
|
|
33
|
-
self._transparency =
|
|
34
|
-
self._transparency.Value = 0
|
|
33
|
+
self._transparency = ValueObject.new(0, "number")
|
|
35
34
|
self._maid:GiveTask(self._transparency)
|
|
36
35
|
|
|
37
36
|
self._input = ColorPickerInput.new()
|
|
@@ -63,7 +62,7 @@ function HSColorPicker.new()
|
|
|
63
62
|
self._maid:GiveTask(self._hsvColorValue.Changed:Connect(function()
|
|
64
63
|
local current = self._hsvColorValue.Value
|
|
65
64
|
local h, s = current.x, current.y
|
|
66
|
-
self._cursor:SetPosition(
|
|
65
|
+
self._cursor:SetPosition(Vector2.new(1 - h, 1 - s))
|
|
67
66
|
end))
|
|
68
67
|
|
|
69
68
|
-- Setup preview
|
|
@@ -149,6 +148,10 @@ function HSColorPicker:GetSizeValue()
|
|
|
149
148
|
return self._sizeValue
|
|
150
149
|
end
|
|
151
150
|
|
|
151
|
+
function HSColorPicker:GetMeasureValue()
|
|
152
|
+
return self._sizeValue
|
|
153
|
+
end
|
|
154
|
+
|
|
152
155
|
--[=[
|
|
153
156
|
Sets the transparency of the HSColorPicker
|
|
154
157
|
|
|
@@ -168,7 +171,7 @@ end
|
|
|
168
171
|
function HSColorPicker:SetSize(height)
|
|
169
172
|
assert(type(height) == "number", "Bad height")
|
|
170
173
|
|
|
171
|
-
self._sizeValue.Value =
|
|
174
|
+
self._sizeValue.Value = Vector2.new(height, height)
|
|
172
175
|
end
|
|
173
176
|
|
|
174
177
|
function HSColorPicker:_render()
|
|
@@ -12,6 +12,7 @@ local Blend = require("Blend")
|
|
|
12
12
|
local HSColorPicker = require("HSColorPicker")
|
|
13
13
|
local ValueColorPicker = require("ValueColorPicker")
|
|
14
14
|
local Maid = require("Maid")
|
|
15
|
+
local ValueObject = require("ValueObject")
|
|
15
16
|
|
|
16
17
|
local HSVColorPicker = setmetatable({}, BaseObject)
|
|
17
18
|
HSVColorPicker.ClassName = "HSVColorPicker"
|
|
@@ -32,21 +33,18 @@ function HSVColorPicker.new()
|
|
|
32
33
|
local self = setmetatable(BaseObject.new(), HSVColorPicker)
|
|
33
34
|
|
|
34
35
|
self._hsvColorValue = Instance.new("Vector3Value")
|
|
35
|
-
self._hsvColorValue.Value = Vector3.
|
|
36
|
+
self._hsvColorValue.Value = Vector3.zero
|
|
36
37
|
self._maid:GiveTask(self._hsvColorValue)
|
|
37
38
|
|
|
38
39
|
self.ColorChanged = self._hsvColorValue.Changed
|
|
39
40
|
|
|
40
|
-
self._sizeValue =
|
|
41
|
-
self._sizeValue.Value = Vector3.new(6, 4, 0)
|
|
41
|
+
self._sizeValue = ValueObject.new(Vector2.new(6, 4), "Vector2")
|
|
42
42
|
self._maid:GiveTask(self._sizeValue)
|
|
43
43
|
|
|
44
|
-
self._innerPadding =
|
|
45
|
-
self._innerPadding.Value = 0.2
|
|
44
|
+
self._innerPadding = ValueObject.new(0.2, "number")
|
|
46
45
|
self._maid:GiveTask(self._innerPadding)
|
|
47
46
|
|
|
48
|
-
self._transparency =
|
|
49
|
-
self._transparency.Value = 0
|
|
47
|
+
self._transparency = ValueObject.new(0, "number")
|
|
50
48
|
self._maid:GiveTask(self._transparency)
|
|
51
49
|
|
|
52
50
|
self._hueSaturationPicker = HSColorPicker.new()
|
|
@@ -193,6 +191,10 @@ function HSVColorPicker:GetSizeValue()
|
|
|
193
191
|
return self._sizeValue
|
|
194
192
|
end
|
|
195
193
|
|
|
194
|
+
function HSVColorPicker:GetMeasureValue()
|
|
195
|
+
return self._sizeValue
|
|
196
|
+
end
|
|
197
|
+
|
|
196
198
|
--[=[
|
|
197
199
|
Sets the transparency of the color
|
|
198
200
|
|
|
@@ -211,7 +213,7 @@ function HSVColorPicker:_updateSize()
|
|
|
211
213
|
local width = valueSize.x + hueSize.x + self._innerPadding.Value
|
|
212
214
|
local height = math.max(valueSize.y, hueSize.y)
|
|
213
215
|
|
|
214
|
-
self._sizeValue.Value =
|
|
216
|
+
self._sizeValue.Value = Vector2.new(width, height)
|
|
215
217
|
end
|
|
216
218
|
|
|
217
219
|
function HSVColorPicker:_render()
|
|
@@ -255,7 +257,7 @@ function HSVColorPicker:_render()
|
|
|
255
257
|
};
|
|
256
258
|
|
|
257
259
|
container(self._hueSaturationPicker, {
|
|
258
|
-
AnchorPoint = Vector2.
|
|
260
|
+
AnchorPoint = Vector2.zero;
|
|
259
261
|
Position = UDim2.fromScale(0, 0);
|
|
260
262
|
});
|
|
261
263
|
container(self._valuePicker, {
|
|
@@ -8,7 +8,7 @@ local require = require(script.Parent.loader).load(script)
|
|
|
8
8
|
local BaseObject = require("BaseObject")
|
|
9
9
|
local Blend = require("Blend")
|
|
10
10
|
local ColorPickerInput = require("ColorPickerInput")
|
|
11
|
-
|
|
11
|
+
local ValueObject = require("ValueObject")
|
|
12
12
|
local ColorPickerCursorPreview = require("ColorPickerCursorPreview")
|
|
13
13
|
local ColorPickerTriangle = require("ColorPickerTriangle")
|
|
14
14
|
|
|
@@ -19,26 +19,21 @@ ValueColorPicker.__index = ValueColorPicker
|
|
|
19
19
|
function ValueColorPicker.new()
|
|
20
20
|
local self = setmetatable(BaseObject.new(), ValueColorPicker)
|
|
21
21
|
|
|
22
|
-
self._hsvColorValue =
|
|
23
|
-
self._hsvColorValue.Value = Vector3.new(0, 0, 0)
|
|
22
|
+
self._hsvColorValue = ValueObject.new(Vector3.zero, "Vector3")
|
|
24
23
|
self._maid:GiveTask(self._hsvColorValue)
|
|
25
24
|
|
|
26
|
-
self._backgroundColorHint =
|
|
27
|
-
self._backgroundColorHint.Value = Color3.new(0, 0, 0)
|
|
25
|
+
self._backgroundColorHint = ValueObject.new(Color3.new(0, 0, 0), "Color3")
|
|
28
26
|
self._maid:GiveTask(self._backgroundColorHint)
|
|
29
27
|
|
|
30
28
|
self.ColorChanged = self._hsvColorValue.Changed
|
|
31
29
|
|
|
32
|
-
self._sizeValue =
|
|
33
|
-
self._sizeValue.Value = Vector3.new(0, 4, 0)
|
|
30
|
+
self._sizeValue = ValueObject.new(Vector2.new(0, 4), "Vector2")
|
|
34
31
|
self._maid:GiveTask(self._sizeValue)
|
|
35
32
|
|
|
36
|
-
self._leftWidth =
|
|
37
|
-
self._leftWidth.Value = 0.25
|
|
33
|
+
self._leftWidth = ValueObject.new(0.25, "number")
|
|
38
34
|
self._maid:GiveTask(self._leftWidth)
|
|
39
35
|
|
|
40
|
-
self._transparency =
|
|
41
|
-
self._transparency.Value = 0
|
|
36
|
+
self._transparency = ValueObject.new(0, "number")
|
|
42
37
|
self._maid:GiveTask(self._transparency)
|
|
43
38
|
|
|
44
39
|
self._input = ColorPickerInput.new()
|
|
@@ -112,7 +107,6 @@ function ValueColorPicker.new()
|
|
|
112
107
|
end))
|
|
113
108
|
self:_updateSize()
|
|
114
109
|
|
|
115
|
-
|
|
116
110
|
return self
|
|
117
111
|
end
|
|
118
112
|
|
|
@@ -127,7 +121,7 @@ function ValueColorPicker:HintBackgroundColor(color)
|
|
|
127
121
|
end
|
|
128
122
|
|
|
129
123
|
function ValueColorPicker:_updatePreviewPosition()
|
|
130
|
-
self._preview:SetPosition(
|
|
124
|
+
self._preview:SetPosition(Vector2.new(0.5, 1 - self._hsvColorValue.Value.z))
|
|
131
125
|
end
|
|
132
126
|
|
|
133
127
|
function ValueColorPicker:_updateSize(newHeight)
|
|
@@ -135,7 +129,7 @@ function ValueColorPicker:_updateSize(newHeight)
|
|
|
135
129
|
local width = self._leftWidth.Value + triangleSize.y
|
|
136
130
|
local height = newHeight or self._sizeValue.Value.y
|
|
137
131
|
|
|
138
|
-
self._sizeValue.Value =
|
|
132
|
+
self._sizeValue.Value = Vector2.new(width, height)
|
|
139
133
|
end
|
|
140
134
|
|
|
141
135
|
function ValueColorPicker:_updateHintedColors()
|
|
@@ -177,6 +171,10 @@ function ValueColorPicker:GetSizeValue()
|
|
|
177
171
|
return self._sizeValue
|
|
178
172
|
end
|
|
179
173
|
|
|
174
|
+
function ValueColorPicker:GetMeasureValue()
|
|
175
|
+
return self._sizeValue
|
|
176
|
+
end
|
|
177
|
+
|
|
180
178
|
function ValueColorPicker:SetTransparency(transparency)
|
|
181
179
|
assert(type(transparency) == "number", "Bad transparency")
|
|
182
180
|
|
|
@@ -9,6 +9,7 @@ local UserInputService = game:GetService("UserInputService")
|
|
|
9
9
|
local BaseObject = require("BaseObject")
|
|
10
10
|
local Maid = require("Maid")
|
|
11
11
|
local InputObjectUtils = require("InputObjectUtils")
|
|
12
|
+
local ValueObject = require("ValueObject")
|
|
12
13
|
|
|
13
14
|
local ColorPickerInput = setmetatable({}, BaseObject)
|
|
14
15
|
ColorPickerInput.ClassName = "ColorPickerInput"
|
|
@@ -25,8 +26,7 @@ function ColorPickerInput.new()
|
|
|
25
26
|
self._numFingerDown.Value = 0
|
|
26
27
|
self._maid:GiveTask(self._numFingerDown)
|
|
27
28
|
|
|
28
|
-
self._currentPosition =
|
|
29
|
-
self._currentPosition.Value = Vector3.new(0, 0, 0)
|
|
29
|
+
self._currentPosition = ValueObject.new(Vector2.zero, "Vector2")
|
|
30
30
|
self._maid:GiveTask(self._currentPosition)
|
|
31
31
|
|
|
32
32
|
self._activePositions = {}
|
|
@@ -196,15 +196,15 @@ function ColorPickerInput:_stopTouchTrack(buttonMaid, inputObject)
|
|
|
196
196
|
end
|
|
197
197
|
|
|
198
198
|
function ColorPickerInput:_toButtonSpace(button, position)
|
|
199
|
-
local pos =
|
|
200
|
-
local size =
|
|
199
|
+
local pos = button.AbsolutePosition
|
|
200
|
+
local size = button.AbsoluteSize
|
|
201
201
|
|
|
202
|
-
local result = (position - pos)/size
|
|
203
|
-
return
|
|
202
|
+
local result = (Vector2.new(position.x, position.y) - pos)/size
|
|
203
|
+
return Vector2.new(math.clamp(result.x, 0, 1), math.clamp(result.y, 0, 1))
|
|
204
204
|
end
|
|
205
205
|
|
|
206
206
|
function ColorPickerInput:_updateCurrentPosition()
|
|
207
|
-
local current =
|
|
207
|
+
local current = Vector2.zero
|
|
208
208
|
local count = 0
|
|
209
209
|
for _, item in pairs(self._activePositions) do
|
|
210
210
|
current = current + item
|