@quenty/buttondragmodel 1.1.0 → 1.1.1-canary.472.c5ee856.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,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
+ ## [1.1.1-canary.472.c5ee856.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/buttondragmodel@1.1.0...@quenty/buttondragmodel@1.1.1-canary.472.c5ee856.0) (2024-05-13)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Fix drag model in color picker code ([a46b6fd](https://github.com/Quenty/NevermoreEngine/commit/a46b6fd06a7a385cdbca1ec6e6102becd499e579))
12
+
13
+
14
+
15
+
16
+
6
17
  # 1.1.0 (2024-05-09)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/buttondragmodel",
3
- "version": "1.1.0",
3
+ "version": "1.1.1-canary.472.c5ee856.0",
4
4
  "description": "Model for dragging buttons around",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,15 +25,15 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/baseobject": "^10.3.0",
29
- "@quenty/inputobjectutils": "^4.4.0",
30
- "@quenty/loader": "^10.3.0",
31
- "@quenty/maid": "^3.2.0",
32
- "@quenty/rx": "^13.3.0",
33
- "@quenty/valueobject": "^13.3.0"
28
+ "@quenty/baseobject": "10.3.0",
29
+ "@quenty/inputobjectutils": "4.4.0",
30
+ "@quenty/loader": "10.3.0",
31
+ "@quenty/maid": "3.2.0",
32
+ "@quenty/rx": "13.3.0",
33
+ "@quenty/valueobject": "13.3.0"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "3fd5cdca3128bf34c8d9dfae1e92d62533b6e6f5"
38
+ "gitHead": "c5ee856d8d75948a21e30b90872bbad28d09e23f"
39
39
  }
@@ -32,17 +32,17 @@ function ButtonDragModel.new(initialButton)
32
32
  self._button = self._maid:Add(ValueObject.new(nil))
33
33
 
34
34
  self._absoluteSize = self._maid:Add(ValueObject.new(Vector2.zero, "Vector2"))
35
- self._isDragging = self._maid:Add(ValueObject.new(false, "boolean"))
35
+ self._isPressed = self._maid:Add(ValueObject.new(false, "boolean"))
36
36
  self._clampWithinButton = self._maid:Add(ValueObject.new(false, "boolean"))
37
37
 
38
38
  self._activePositions = {}
39
39
 
40
40
  self._maid:GiveTask(self._dragPosition.Changed:Connect(function()
41
- self._isDragging.Value = self._dragPosition.Value ~= nil
41
+ self._isPressed.Value = self._dragPosition.Value ~= nil
42
42
  end))
43
43
 
44
44
  self.DragPositionChanged = self._dragPosition.Changed
45
- self.IsDraggingChanged = self._isDragging.Changed
45
+ self.IsDraggingChanged = self._isPressed.Changed
46
46
 
47
47
  if initialButton then
48
48
  self:SetButton(initialButton)
@@ -62,20 +62,29 @@ function ButtonDragModel.new(initialButton)
62
62
  return self
63
63
  end
64
64
 
65
+ --[=[
66
+ Returns true if pressed
67
+
68
+ @return boolean
69
+ ]=]
70
+ function ButtonDragModel:IsPressed()
71
+ return self._isPressed.Value
72
+ end
73
+
65
74
  --[=[
66
75
  Observes if anything is pressing down on the button itself
67
76
 
68
77
  @return Observable<boolean>
69
78
  ]=]
70
- function ButtonDragModel:ObserveIsDragging()
71
- return self._isDragging:Observe()
79
+ function ButtonDragModel:ObserveIsPressed()
80
+ return self._isPressed:Observe()
72
81
  end
73
82
 
74
83
  --[=[
75
84
  @return Observable<Brio<true>>
76
85
  ]=]
77
- function ButtonDragModel:ObserveIsDraggingBrio()
78
- return self._isDragging:ObserveBrio(function(value)
86
+ function ButtonDragModel:ObserveIsPressedBrio()
87
+ return self._isPressed:ObserveBrio(function(value)
79
88
  return value
80
89
  end)
81
90
  end
@@ -94,15 +103,6 @@ function ButtonDragModel:GetDragDelta()
94
103
  return self._dragDelta.Value
95
104
  end
96
105
 
97
- --[=[
98
- Returns true if pressed
99
-
100
- @return boolean
101
- ]=]
102
- function ButtonDragModel:GetIsPressed()
103
- return self._isDragging.Value
104
- end
105
-
106
106
  --[=[
107
107
  Returns the scale position on the Gui from 0 to 1
108
108
 
@@ -323,7 +323,7 @@ function ButtonDragModel:_updateCurrentPosition()
323
323
 
324
324
  if self._clampWithinButton.Value then
325
325
  x = math.clamp(x, 0, 1)
326
- y = math.clamp(x, 0, 1)
326
+ y = math.clamp(y, 0, 1)
327
327
  end
328
328
 
329
329
  local position = Vector2.new(x, y)