@quenty/colorpicker 10.3.0 → 10.4.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 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.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpicker@10.3.0...@quenty/colorpicker@10.4.0) (2024-05-09)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Bootstrap specifically to loader ([7f4d4f9](https://github.com/Quenty/NevermoreEngine/commit/7f4d4f9cd4a6602af8daaf04983bb349dafc7e95))
12
+ * Fix .package-lock.json replicating in packages ([75d0efe](https://github.com/Quenty/NevermoreEngine/commit/75d0efeef239f221d93352af71a5b3e930ec23c5))
13
+
14
+
15
+
16
+
17
+
6
18
  # [10.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/colorpicker@10.2.1...@quenty/colorpicker@10.3.0) (2024-04-27)
7
19
 
8
20
  **Note:** Version bump only for package @quenty/colorpicker
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "colorpicker",
3
+ "globIgnorePaths": [ "**/.package-lock.json" ],
3
4
  "tree": {
4
5
  "$path": "src"
5
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/colorpicker",
3
- "version": "10.3.0",
3
+ "version": "10.4.0",
4
4
  "description": "Color picking UI system for Roblox.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -28,16 +28,17 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@quenty/baseobject": "^10.2.0",
32
- "@quenty/basicpane": "^13.2.0",
33
- "@quenty/blend": "^12.2.0",
34
- "@quenty/color3utils": "^11.2.0",
35
- "@quenty/inputobjectutils": "^4.3.0",
36
- "@quenty/instanceutils": "^13.2.0",
37
- "@quenty/loader": "^10.2.0",
38
- "@quenty/maid": "^3.1.0",
39
- "@quenty/math": "^2.6.0",
40
- "@quenty/valueobject": "^13.2.0"
31
+ "@quenty/baseobject": "^10.3.0",
32
+ "@quenty/basicpane": "^13.3.0",
33
+ "@quenty/blend": "^12.3.0",
34
+ "@quenty/buttondragmodel": "^1.1.0",
35
+ "@quenty/color3utils": "^11.3.0",
36
+ "@quenty/inputobjectutils": "^4.4.0",
37
+ "@quenty/instanceutils": "^13.3.0",
38
+ "@quenty/loader": "^10.3.0",
39
+ "@quenty/maid": "^3.2.0",
40
+ "@quenty/math": "^2.7.0",
41
+ "@quenty/valueobject": "^13.3.0"
41
42
  },
42
- "gitHead": "5c9eab1eac73f0d54953cca5017b7be968182f72"
43
+ "gitHead": "3fd5cdca3128bf34c8d9dfae1e92d62533b6e6f5"
43
44
  }
@@ -18,26 +18,13 @@ HSColorPickerCursor.__index = HSColorPickerCursor
18
18
  function HSColorPickerCursor.new()
19
19
  local self = setmetatable(BaseObject.new(), HSColorPickerCursor)
20
20
 
21
- self._backgroundColorHint = ValueObject.new(Color3.new(0, 0, 0), "Color3")
22
- self._maid:GiveTask(self._backgroundColorHint)
23
-
24
- self._height = ValueObject.new(0.075, "number")
25
- self._maid:GiveTask(self._height)
26
-
27
- self._crossHairWidthAbs = ValueObject.new(1, "number")
28
- self._maid:GiveTask(self._crossHairWidthAbs)
29
-
30
- self._verticalHairVisible = ValueObject.new(true, "boolean")
31
- self._maid:GiveTask(self._verticalHairVisible)
32
-
33
- self._horizontalHairVisible = ValueObject.new(true, "boolean")
34
- self._maid:GiveTask(self._horizontalHairVisible)
35
-
36
- self._position = ValueObject.new(Vector2.zero, "Vector2")
37
- self._maid:GiveTask(self._position)
38
-
39
- self._transparency = ValueObject.new(0, "number")
40
- self._maid:GiveTask(self._transparency)
21
+ self._backgroundColorHint = self._maid:Add(ValueObject.new(Color3.new(0, 0, 0), "Color3"))
22
+ self._height = self._maid:Add(ValueObject.new(0.075, "number"))
23
+ self._crossHairWidthAbs = self._maid:Add(ValueObject.new(1, "number"))
24
+ self._verticalHairVisible = self._maid:Add(ValueObject.new(true, "boolean"))
25
+ self._horizontalHairVisible = self._maid:Add(ValueObject.new(true, "boolean"))
26
+ self._position = self._maid:Add(ValueObject.new(Vector2.zero, "Vector2"))
27
+ self._transparency = self._maid:Add(ValueObject.new(0, "number"))
41
28
 
42
29
  self._maid:GiveTask(self:_render():Subscribe(function(gui)
43
30
  self.Gui = gui
@@ -10,7 +10,7 @@ local require = require(script.Parent.loader).load(script)
10
10
  local BaseObject = require("BaseObject")
11
11
  local Blend = require("Blend")
12
12
  local ColorPickerCursorPreview = require("ColorPickerCursorPreview")
13
- local ColorPickerInput = require("ColorPickerInput")
13
+ local ButtonDragModel = require("ButtonDragModel")
14
14
  local HSColorPickerCursor = require("HSColorPickerCursor")
15
15
  local ValueObject = require("ValueObject")
16
16
 
@@ -21,26 +21,17 @@ HSColorPicker.__index = HSColorPicker
21
21
  function HSColorPicker.new()
22
22
  local self = setmetatable(BaseObject.new(), HSColorPicker)
23
23
 
24
- self._hsvColorValue = Instance.new("Vector3Value")
25
- self._hsvColorValue.Value = Vector3.zero
26
- self._maid:GiveTask(self._hsvColorValue)
24
+ self._hsvColorValue = self._maid:Add(ValueObject.new(Vector3.zero, "Vector3"))
25
+ self._sizeValue = self._maid:Add(ValueObject.new(Vector2.new(4, 4), "Vector2"))
26
+ self._transparency = self._maid:Add(ValueObject.new(0, "number"))
27
27
 
28
- self.ColorChanged = self._hsvColorValue.Changed
29
-
30
- self._sizeValue = ValueObject.new(Vector2.new(4, 4), "Vector2")
31
- self._maid:GiveTask(self._sizeValue)
32
-
33
- self._transparency = ValueObject.new(0, "number")
34
- self._maid:GiveTask(self._transparency)
28
+ self._dragModel = self._maid:Add(ButtonDragModel.new())
29
+ self._dragModel:SetClampWithinButton(true)
35
30
 
36
- self._input = ColorPickerInput.new()
37
- self._maid:GiveTask(self._input)
31
+ self._cursor = self._maid:Add(HSColorPickerCursor.new())
32
+ self._preview = self._maid:Add(ColorPickerCursorPreview.new())
38
33
 
39
- self._cursor = HSColorPickerCursor.new()
40
- self._maid:GiveTask(self._cursor)
41
-
42
- self._preview = ColorPickerCursorPreview.new()
43
- self._maid:GiveTask(self._preview)
34
+ self.ColorChanged = self._hsvColorValue.Changed
44
35
 
45
36
  self._maid:GiveTask(self:_render():Subscribe(function(gui)
46
37
  self.Gui = gui
@@ -52,11 +43,13 @@ function HSColorPicker.new()
52
43
  end))
53
44
 
54
45
  -- Binding
55
- self._maid:GiveTask(self._input.PositionChanged:Connect(function()
56
- local position = self._input:GetPosition()
57
- local v = self._hsvColorValue.Value.z
58
- self._hsvColorValue.Value = Vector3.new(1 - position.x, 1 - position.y, v)
59
- self._cursor:SetPosition(position)
46
+ self._maid:GiveTask(self._dragModel.DragPositionChanged:Connect(function()
47
+ local position = self._dragModel:GetDragPosition()
48
+ if position then
49
+ local v = self._hsvColorValue.Value.z
50
+ self._hsvColorValue.Value = Vector3.new(1 - position.x, 1 - position.y, v)
51
+ self._cursor:SetPosition(position)
52
+ end
60
53
  end))
61
54
 
62
55
  self._maid:GiveTask(self._hsvColorValue.Changed:Connect(function()
@@ -66,8 +59,8 @@ function HSColorPicker.new()
66
59
  end))
67
60
 
68
61
  -- Setup preview
69
- self._maid:GiveTask(self._input.IsPressedChanged:Connect(function()
70
- self._preview:SetVisible(self._input:GetIsPressed())
62
+ self._maid:GiveTask(self._dragModel:ObserveIsDragging():Subscribe(function(isDragging)
63
+ self._preview:SetVisible(isDragging)
71
64
  end))
72
65
  self._maid:GiveTask(self._cursor.PositionChanged:Connect(function()
73
66
  self._preview:SetPosition(self._cursor:GetPosition())
@@ -85,8 +78,8 @@ end
85
78
 
86
79
  @return BoolValue
87
80
  ]=]
88
- function HSColorPicker:GetIsPressedValue()
89
- return self._input:GetIsPressedValue()
81
+ function HSColorPicker:ObserveIsPressed()
82
+ return self._dragModel:ObserveIsPressed()
90
83
  end
91
84
 
92
85
  function HSColorPicker:_updateHintedColors()
@@ -183,7 +176,7 @@ function HSColorPicker:_render()
183
176
  Image = "rbxassetid://9290917908";
184
177
  ImageTransparency = self._transparency;
185
178
  [Blend.Instance] = function(inst)
186
- self._input:SetButton(inst)
179
+ self._dragModel:SetButton(inst)
187
180
  end;
188
181
  [Blend.Children] = {
189
182
  Blend.New "UIAspectRatioConstraint" {
@@ -2,7 +2,7 @@
2
2
  @class serviceBag.story
3
3
  ]]
4
4
 
5
- local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).load(script)
5
+ local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
6
6
 
7
7
  local Maid = require("Maid")
8
8
  local HSColorPicker = require("HSColorPicker")
@@ -223,7 +223,7 @@ function HSVColorPicker:_render()
223
223
  Position = props.Position;
224
224
  BackgroundTransparency = 1;
225
225
  Size = UDim2.new(1, 0, 1, 0);
226
- ZIndex = Blend.Computed(picker:GetIsPressedValue(), function(isPressed)
226
+ ZIndex = Blend.Computed(picker:ObserveIsPressed(), function(isPressed)
227
227
  return isPressed and 2 or 1
228
228
  end);
229
229
  [Blend.Children] = {
@@ -2,7 +2,7 @@
2
2
  @class HSVColorPicker.story
3
3
  ]]
4
4
 
5
- local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).load(script)
5
+ local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
6
6
 
7
7
  local Maid = require("Maid")
8
8
  local HSVColorPicker = require("HSVColorPicker")
@@ -7,7 +7,7 @@ local require = require(script.Parent.loader).load(script)
7
7
 
8
8
  local BaseObject = require("BaseObject")
9
9
  local Blend = require("Blend")
10
- local ColorPickerInput = require("ColorPickerInput")
10
+ local ButtonDragModel = require("ButtonDragModel")
11
11
  local ValueObject = require("ValueObject")
12
12
  local ColorPickerCursorPreview = require("ColorPickerCursorPreview")
13
13
  local ColorPickerTriangle = require("ColorPickerTriangle")
@@ -19,26 +19,16 @@ ValueColorPicker.__index = ValueColorPicker
19
19
  function ValueColorPicker.new()
20
20
  local self = setmetatable(BaseObject.new(), ValueColorPicker)
21
21
 
22
- self._hsvColorValue = ValueObject.new(Vector3.zero, "Vector3")
23
- self._maid:GiveTask(self._hsvColorValue)
22
+ self._hsvColorValue = self._maid:Add(ValueObject.new(Vector3.zero, "Vector3"))
23
+ self._backgroundColorHint = self._maid:Add(ValueObject.new(Color3.new(0, 0, 0), "Color3"))
24
+ self._sizeValue = self._maid:Add(ValueObject.new(Vector2.new(0, 4), "Vector2"))
25
+ self._leftWidth = self._maid:Add(ValueObject.new(0.25, "number"))
26
+ self._transparency = self._maid:Add(ValueObject.new(0, "number"))
24
27
 
25
- self._backgroundColorHint = ValueObject.new(Color3.new(0, 0, 0), "Color3")
26
- self._maid:GiveTask(self._backgroundColorHint)
28
+ self._dragModel = self._maid:Add(ButtonDragModel.new())
29
+ self._dragModel:SetClampWithinButton(true)
27
30
 
28
31
  self.ColorChanged = self._hsvColorValue.Changed
29
-
30
- self._sizeValue = ValueObject.new(Vector2.new(0, 4), "Vector2")
31
- self._maid:GiveTask(self._sizeValue)
32
-
33
- self._leftWidth = ValueObject.new(0.25, "number")
34
- self._maid:GiveTask(self._leftWidth)
35
-
36
- self._transparency = ValueObject.new(0, "number")
37
- self._maid:GiveTask(self._transparency)
38
-
39
- self._input = ColorPickerInput.new()
40
- self._maid:GiveTask(self._input)
41
-
42
32
  -- self._cursor = HSColorPickerCursor.new()
43
33
  -- self._cursor:SetHeight(1)
44
34
  -- self._cursor:SetVerticalHairVisible(false)
@@ -65,13 +55,15 @@ function ValueColorPicker.new()
65
55
  end))
66
56
 
67
57
  -- Binding
68
- self._maid:GiveTask(self._input.PositionChanged:Connect(function()
69
- local position = self._input:GetPosition()
70
- local current = self._hsvColorValue.Value
71
- local h, s = current.x, current.y
72
- self._hsvColorValue.Value = Vector3.new(h, s, 1 - position.y)
73
- -- self._cursor:SetPosition(Vector3.new(0.5, position.y, 0))
74
- self._triangle.Gui.Position = UDim2.fromScale(0, position.y)
58
+ self._maid:GiveTask(self._dragModel.DragPositionChanged:Connect(function()
59
+ local position = self._dragModel:GetDragPosition()
60
+ if position then
61
+ local current = self._hsvColorValue.Value
62
+ local h, s = current.x, current.y
63
+ self._hsvColorValue.Value = Vector3.new(h, s, 1 - position.y)
64
+ -- self._cursor:SetPosition(Vector3.new(0.5, position.y, 0))
65
+ self._triangle.Gui.Position = UDim2.fromScale(0, position.y)
66
+ end
75
67
  end))
76
68
  self._maid:GiveTask(self._hsvColorValue.Changed:Connect(function()
77
69
  local v = self._hsvColorValue.Value.z
@@ -80,8 +72,8 @@ function ValueColorPicker.new()
80
72
  end))
81
73
 
82
74
  -- Setup preview
83
- self._maid:GiveTask(self._input.IsPressedChanged:Connect(function()
84
- self._preview:SetVisible(self._input:GetIsPressed())
75
+ self._maid:GiveTask(self._dragModel:ObserveIsDragging():Subscribe(function(isDragging)
76
+ self._preview:SetVisible(isDragging)
85
77
  end))
86
78
  self._maid:GiveTask(self._hsvColorValue.Changed:Connect(function()
87
79
  self:_updatePreviewPosition()
@@ -142,8 +134,8 @@ function ValueColorPicker:_updateHintedColors()
142
134
  self._preview:SetColor(color)
143
135
  end
144
136
 
145
- function ValueColorPicker:GetIsPressedValue()
146
- return self._input:GetIsPressedValue()
137
+ function ValueColorPicker:ObserveIsPressed()
138
+ return self._dragModel:ObserveIsPressed()
147
139
  end
148
140
 
149
141
  function ValueColorPicker:SetHSVColor(hsvColor)
@@ -188,7 +180,7 @@ function ValueColorPicker:_render()
188
180
  BackgroundTransparency = 1;
189
181
  Active = true;
190
182
  [Blend.Instance] = function(inst)
191
- self._input:SetButton(inst)
183
+ self._dragModel:SetButton(inst)
192
184
  end;
193
185
  [Blend.Children] = {
194
186
  Blend.New "UIAspectRatioConstraint" {
@@ -2,7 +2,7 @@
2
2
  @class ValueColorPicker.story
3
3
  ]]
4
4
 
5
- local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).load(script)
5
+ local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
6
6
 
7
7
  local Maid = require("Maid")
8
8
  local ValueColorPicker = require("ValueColorPicker")
@@ -1,221 +0,0 @@
1
- --[=[
2
- @class ColorPickerInput
3
- ]=]
4
-
5
- local require = require(script.Parent.loader).load(script)
6
-
7
- local UserInputService = game:GetService("UserInputService")
8
-
9
- local BaseObject = require("BaseObject")
10
- local Maid = require("Maid")
11
- local InputObjectUtils = require("InputObjectUtils")
12
- local ValueObject = require("ValueObject")
13
-
14
- local ColorPickerInput = setmetatable({}, BaseObject)
15
- ColorPickerInput.ClassName = "ColorPickerInput"
16
- ColorPickerInput.__index = ColorPickerInput
17
-
18
- function ColorPickerInput.new()
19
- local self = setmetatable(BaseObject.new(), ColorPickerInput)
20
-
21
- self._isMouseDown = Instance.new("BoolValue")
22
- self._isMouseDown.Value = false
23
- self._maid:GiveTask(self._isMouseDown)
24
-
25
- self._numFingerDown = Instance.new("IntValue")
26
- self._numFingerDown.Value = 0
27
- self._maid:GiveTask(self._numFingerDown)
28
-
29
- self._currentPosition = ValueObject.new(Vector2.zero, "Vector2")
30
- self._maid:GiveTask(self._currentPosition)
31
-
32
- self._activePositions = {}
33
-
34
- self._isPressed = Instance.new("BoolValue")
35
- self._isPressed.Value = false
36
- self._maid:GiveTask(self._isPressed)
37
-
38
- self._maid:GiveTask(self._isMouseDown.Changed:Connect(function()
39
- self:_updateIsPressed()
40
- end))
41
- self._maid:GiveTask(self._numFingerDown.Changed:Connect(function()
42
- self:_updateIsPressed()
43
- end))
44
-
45
- self.PositionChanged = self._currentPosition.Changed
46
- self.IsPressedChanged = self._isPressed.Changed
47
-
48
- return self
49
- end
50
-
51
- function ColorPickerInput:GetIsPressedValue()
52
- return self._isPressed
53
- end
54
-
55
- function ColorPickerInput:GetPosition()
56
- return self._currentPosition.Value
57
- end
58
-
59
- function ColorPickerInput:GetIsPressed()
60
- return self._isPressed.Value
61
- end
62
-
63
- function ColorPickerInput:SetButton(button)
64
- if not button then
65
- self._maid._button = nil
66
- return
67
- end
68
-
69
- local maid = Maid.new()
70
-
71
- maid:GiveTask(button.InputBegan:Connect(function(inputObject)
72
- if inputObject.UserInputType == Enum.UserInputType.MouseButton1 then
73
- self._isMouseDown.Value = true
74
- self._activePositions.mouse = self:_toButtonSpace(button, inputObject.Position)
75
- self:_updateCurrentPosition()
76
- end
77
-
78
- if inputObject.UserInputType == Enum.UserInputType.Touch then
79
- self:_trackTouch(maid, button, inputObject)
80
- end
81
- end))
82
-
83
- maid:GiveTask(button.InputEnded:Connect(function(inputObject)
84
- if inputObject.UserInputType == Enum.UserInputType.MouseButton1 then
85
- self._isMouseDown.Value = false
86
- end
87
-
88
- if inputObject.UserInputType == Enum.UserInputType.Touch then
89
- self:_stopTouchTrack(maid, inputObject)
90
- end
91
- end))
92
-
93
- maid:GiveTask(UserInputService.InputEnded:Connect(function(inputObject)
94
- if inputObject.UserInputType == Enum.UserInputType.MouseButton1 then
95
- self._isMouseDown.Value = false
96
- end
97
- end))
98
-
99
- maid:GiveTask(function()
100
- self._isMouseDown.Value = false
101
- end)
102
-
103
- maid:GiveTask(self._isMouseDown.Changed:Connect(function()
104
- self:_updateMouseTracking(maid, button)
105
- end))
106
-
107
- self._maid._button = maid
108
- end
109
-
110
- function ColorPickerInput:_updateIsPressed()
111
- if self._numFingerDown.Value > 0 or self._isMouseDown.Value then
112
- self._isPressed.Value = true
113
- else
114
- self._isPressed.Value = false
115
- end
116
- end
117
-
118
- function ColorPickerInput:_updateMouseTracking(buttonMaid, button)
119
- if not self._isMouseDown.Value then
120
- buttonMaid._mouse = nil
121
- return
122
- end
123
-
124
- local maid = Maid.new()
125
-
126
- maid:GiveTask(UserInputService.InputChanged:Connect(function(inputObject)
127
- if not InputObjectUtils.isMouseUserInputType(inputObject.UserInputType) then
128
- return
129
- end
130
-
131
- local screenGui = button:FindFirstAncestorWhichIsA("ScreenGui")
132
- if not screenGui then
133
- return
134
- end
135
-
136
- if not (screenGui:FindFirstAncestorWhichIsA("PlayerGui") or screenGui:FindFirstAncestorWhichIsA("CoreGui")) then
137
- -- TODO: Handle billboard guis
138
- return
139
- end
140
-
141
- self._activePositions.mouse = self:_toButtonSpace(button, inputObject.Position)
142
- self:_updateCurrentPosition()
143
- end))
144
-
145
- maid:GiveTask(button.InputChanged:Connect(function(inputObject)
146
- if InputObjectUtils.isMouseUserInputType(inputObject.UserInputType) then
147
- self._activePositions.mouse = self:_toButtonSpace(button, inputObject.Position)
148
- self:_updateCurrentPosition()
149
- end
150
- end))
151
-
152
- maid:GiveTask(function()
153
- self._activePositions.mouse = nil
154
- self:_updateCurrentPosition()
155
- end)
156
-
157
- buttonMaid._mouse = maid
158
- end
159
-
160
- function ColorPickerInput:_trackTouch(buttonMaid, button, inputObject)
161
- buttonMaid[inputObject] = nil
162
-
163
- if inputObject.UserInputState == Enum.UserInputState.End then
164
- return
165
- end
166
-
167
- local maid = Maid.new()
168
-
169
- self._activePositions[inputObject] = self:_toButtonSpace(button, inputObject.Position)
170
- self._numFingerDown.Value = self._numFingerDown.Value + 1
171
-
172
- maid:GiveTask(inputObject:GetPropertyChangedSignal("Position"):Connect(function()
173
- self._activePositions[inputObject] = self:_toButtonSpace(button, inputObject.Position)
174
- self:_updateCurrentPosition()
175
- end))
176
- maid:GiveTask(inputObject:GetPropertyChangedSignal("UserInputState"):Connect(function()
177
- if inputObject.UserInputState == Enum.UserInputState.End then
178
- maid[inputObject] = nil
179
- end
180
- end))
181
-
182
- maid:GiveTask(function()
183
- self._activePositions[inputObject] = nil
184
- self._numFingerDown.Value = self._numFingerDown.Value - 1
185
- self:_updateCurrentPosition()
186
- end)
187
-
188
- self:_updateCurrentPosition()
189
-
190
- maid[inputObject] = maid
191
- end
192
-
193
- function ColorPickerInput:_stopTouchTrack(buttonMaid, inputObject)
194
- -- Clears the input tracking as we slide off the button
195
- buttonMaid[inputObject] = nil
196
- end
197
-
198
- function ColorPickerInput:_toButtonSpace(button, position)
199
- local pos = button.AbsolutePosition
200
- local size = button.AbsoluteSize
201
-
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
- end
205
-
206
- function ColorPickerInput:_updateCurrentPosition()
207
- local current = Vector2.zero
208
- local count = 0
209
- for _, item in pairs(self._activePositions) do
210
- current = current + item
211
- count = count + 1
212
- end
213
- if count == 0 then
214
- return
215
- end
216
-
217
- current = current/count
218
- self._currentPosition.Value = current
219
- end
220
-
221
- return ColorPickerInput