@quenty/viewport 11.5.0 → 11.6.1
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 +19 -0
- package/package.json +3 -3
- package/src/Client/Viewport.lua +22 -1
- package/src/Client/ViewportControls.lua +15 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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
|
+
## [11.6.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@11.6.0...@quenty/viewport@11.6.1) (2024-07-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/viewport
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [11.6.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@11.5.0...@quenty/viewport@11.6.0) (2024-07-08)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* added enabled controls to viewport controls ([e945319](https://github.com/Quenty/NevermoreEngine/commit/e94531946e293f2e4b4da821f0d94f2c89d70248))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [11.5.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@11.4.0...@quenty/viewport@11.5.0) (2024-05-09)
|
|
7
26
|
|
|
8
27
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/viewport",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.6.1",
|
|
4
4
|
"description": "Rendering functionality for viewportFrames",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@quenty/baseobject": "^10.3.0",
|
|
29
29
|
"@quenty/basicpane": "^13.3.0",
|
|
30
30
|
"@quenty/blend": "^12.3.0",
|
|
31
|
-
"@quenty/camera": "^14.5.
|
|
31
|
+
"@quenty/camera": "^14.5.1",
|
|
32
32
|
"@quenty/geometryutils": "^6.3.0",
|
|
33
33
|
"@quenty/inputobjectutils": "^4.4.0",
|
|
34
34
|
"@quenty/loader": "^10.3.0",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@quenty/insertserviceutils": "^10.3.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "d9ffcf779b43c299fbb2dd0bd15d56b83b3e5043"
|
|
49
49
|
}
|
package/src/Client/Viewport.lua
CHANGED
|
@@ -52,6 +52,7 @@ function Viewport.new()
|
|
|
52
52
|
self._transparency = self._maid:Add(ValueObject.new(0, "number"))
|
|
53
53
|
self._absoluteSize = self._maid:Add(ValueObject.new(Vector2.zero, "Vector2"))
|
|
54
54
|
self._fieldOfView = self._maid:Add(ValueObject.new(20, "number"))
|
|
55
|
+
self._controlsEnabled = self._maid:Add(ValueObject.new(true, "boolean"))
|
|
55
56
|
|
|
56
57
|
self._rotationYawSpring = self._maid:Add(SpringObject.new(math.rad(90 + 90 - 30)))
|
|
57
58
|
self._rotationYawSpring.Speed = 30
|
|
@@ -126,6 +127,17 @@ function Viewport:ObserveTransparency()
|
|
|
126
127
|
return self._transparency:Observe()
|
|
127
128
|
end
|
|
128
129
|
|
|
130
|
+
--[=[
|
|
131
|
+
Sets the enabled state of the ViewportControls
|
|
132
|
+
|
|
133
|
+
@param enabled boolean
|
|
134
|
+
]=]
|
|
135
|
+
function Viewport:SetControlsEnabled(enabled)
|
|
136
|
+
assert(type(enabled) == "boolean", "Bad enabled")
|
|
137
|
+
|
|
138
|
+
self._controlsEnabled.Value = enabled
|
|
139
|
+
end
|
|
140
|
+
|
|
129
141
|
--[=[
|
|
130
142
|
Sets the field of view on the viewport.
|
|
131
143
|
|
|
@@ -253,7 +265,16 @@ function Viewport:Render(props)
|
|
|
253
265
|
end);
|
|
254
266
|
[Blend.OnChange "AbsoluteSize"] = self._absoluteSize;
|
|
255
267
|
[Blend.Attached(function(viewport)
|
|
256
|
-
|
|
268
|
+
local controlsMaid = Maid.new()
|
|
269
|
+
|
|
270
|
+
-- create viewport controls and obey enabled state
|
|
271
|
+
local viewportControls = ViewportControls.new(viewport, self)
|
|
272
|
+
controlsMaid:Add(viewportControls)
|
|
273
|
+
controlsMaid:Add(self._controlsEnabled:Observe():Subscribe(function(controlsEnabled)
|
|
274
|
+
viewportControls:SetEnabled(controlsEnabled)
|
|
275
|
+
end))
|
|
276
|
+
|
|
277
|
+
return controlsMaid
|
|
257
278
|
end)] = true;
|
|
258
279
|
[Blend.Attached(function(viewport)
|
|
259
280
|
-- custom parenting scheme to ensure we don't call destroy on children
|
|
@@ -8,6 +8,7 @@ local require = require(script.Parent.loader).load(script)
|
|
|
8
8
|
local BaseObject = require("BaseObject")
|
|
9
9
|
local Maid = require("Maid")
|
|
10
10
|
local InputObjectUtils = require("InputObjectUtils")
|
|
11
|
+
local ValueObject = require("ValueObject")
|
|
11
12
|
|
|
12
13
|
local SENSITIVITY = Vector2.new(8, 4)
|
|
13
14
|
|
|
@@ -25,11 +26,13 @@ function ViewportControls.new(viewport, viewportModel)
|
|
|
25
26
|
local self = setmetatable(BaseObject.new(viewport), ViewportControls)
|
|
26
27
|
|
|
27
28
|
self._viewportModel = assert(viewportModel, "No rotationYaw")
|
|
29
|
+
self._enabled = self._maid:Add(ValueObject.new(true, "boolean"))
|
|
28
30
|
|
|
29
31
|
self._maid:GiveTask(self._obj.InputBegan:Connect(function(inputObject)
|
|
30
32
|
if inputObject.UserInputType == Enum.UserInputType.MouseButton1
|
|
31
33
|
or inputObject.UserInputType == Enum.UserInputType.MouseButton2
|
|
32
|
-
or inputObject.UserInputType == Enum.UserInputType.Touch
|
|
34
|
+
or inputObject.UserInputType == Enum.UserInputType.Touch
|
|
35
|
+
and self._enabled.Value then
|
|
33
36
|
self:_startDrag(inputObject)
|
|
34
37
|
end
|
|
35
38
|
end))
|
|
@@ -37,6 +40,17 @@ function ViewportControls.new(viewport, viewportModel)
|
|
|
37
40
|
return self
|
|
38
41
|
end
|
|
39
42
|
|
|
43
|
+
--[=[
|
|
44
|
+
Sets the enabled state of the controls
|
|
45
|
+
|
|
46
|
+
@param enabled boolean
|
|
47
|
+
]=]
|
|
48
|
+
function ViewportControls:SetEnabled(enabled)
|
|
49
|
+
assert(type(enabled) == "boolean", "Bad enabled")
|
|
50
|
+
|
|
51
|
+
self._enabled.Value = enabled
|
|
52
|
+
end
|
|
53
|
+
|
|
40
54
|
function ViewportControls:_startDrag(startInputObject)
|
|
41
55
|
if self._maid._dragging then
|
|
42
56
|
return
|