@quenty/inputobjectutils 2.0.1-canary.c3c8cd3.0 → 2.0.2

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,12 +3,20 @@
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.1-canary.c3c8cd3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/inputobjectutils@2.0.0...@quenty/inputobjectutils@2.0.1-canary.c3c8cd3.0) (2021-10-12)
6
+ ## [2.0.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/inputobjectutils@2.0.1...@quenty/inputobjectutils@2.0.2) (2021-12-30)
7
+
8
+ **Note:** Version bump only for package @quenty/inputobjectutils
9
+
10
+
11
+
12
+
13
+
14
+ ## [2.0.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/inputobjectutils@2.0.0...@quenty/inputobjectutils@2.0.1) (2021-10-13)
7
15
 
8
16
 
9
17
  ### Bug Fixes
10
18
 
11
- * InputObjectRayUtils allows the specification of the camera ([c3c8cd3](https://github.com/Quenty/NevermoreEngine/commit/c3c8cd3fe14e7342315d82f45c53f887be5ce192))
19
+ * InputObjectRayUtils allows the specification of the camera ([4956ef9](https://github.com/Quenty/NevermoreEngine/commit/4956ef91728c9a8f763dab565f56e439981b122f))
12
20
 
13
21
 
14
22
 
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2014 Quenty
3
+ Copyright (c) 2014-2021 Quenty
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  ## InputObjectUtils
2
2
  <div align="center">
3
- <a href="http://quenty.github.io/api/">
4
- <img src="https://img.shields.io/badge/docs-website-green.svg" alt="Documentation" />
3
+ <a href="http://quenty.github.io/NevermoreEngine/">
4
+ <img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
5
5
  </a>
6
6
  <a href="https://discord.gg/mhtGUS8">
7
- <img src="https://img.shields.io/badge/discord-nevermore-blue.svg" alt="Discord" />
7
+ <img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
8
8
  </a>
9
9
  <a href="https://github.com/Quenty/NevermoreEngine/actions">
10
10
  <img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/build.yml/badge.svg" alt="Build and release status" />
@@ -13,26 +13,9 @@
13
13
 
14
14
  Provides utility functions involving input objects
15
15
 
16
+ <div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/InputObjectRayUtils">View docs →</a></div>
17
+
16
18
  ## Installation
17
19
  ```
18
20
  npm install @quenty/inputobjectutils --save
19
- ```
20
-
21
- ## InputObjectRayUtils API
22
-
23
- ### `InputObjectRayUtils.cameraRayFromInputObject(inputObject, distance)`
24
-
25
- ### `InputObjectRayUtils.cameraRayFromInputObjectWithOffset(inputObject, distance, offset)`
26
-
27
- ### `InputObjectRayUtils.cameraRayFromScreenPosition(position, distance)`
28
-
29
- ### `InputObjectRayUtils.cameraRayFromViewportPosition(position, distance)`
30
-
31
- ### `InputObjectRayUtils.generateCircleRays(ray, count, radius)`
32
- Generates a circle of rays including the center ray
33
-
34
- ## InputObjectUtils API
35
-
36
- ### `InputObjectUtils.isMouseUserInputType(userInputType)`
37
-
38
- ### `InputObjectUtils.isSameInputObject(inputObject, otherInputObject)`
21
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/inputobjectutils",
3
- "version": "2.0.1-canary.c3c8cd3.0",
3
+ "version": "2.0.2",
4
4
  "description": "Provides utility functions involving input objects",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -27,5 +27,5 @@
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
- "gitHead": "c3c8cd3fe14e7342315d82f45c53f887be5ce192"
30
+ "gitHead": "d146c77d0a8e452824de0ab0b4b03ba0370bcc1b"
31
31
  }
@@ -1,5 +1,7 @@
1
- --- Utility functions for constructing rays from input objects
2
- -- @module InputObjectRayUtils
1
+ --[=[
2
+ Utility functions for constructing rays from input objects
3
+ @class InputObjectRayUtils
4
+ ]=]
3
5
 
4
6
  local Workspace = game:GetService("Workspace")
5
7
 
@@ -7,6 +9,14 @@ local DEFAULT_RAY_DISTANCE = 1000
7
9
 
8
10
  local InputObjectRayUtils = {}
9
11
 
12
+ --[=[
13
+ Computes a camera ray from an inputObject
14
+ @param inputObject InputObject
15
+ @param distance number
16
+ @param offset Vector3? -- Optional
17
+ @param camera Camera? -- Optional
18
+ @return Ray
19
+ ]=]
10
20
  function InputObjectRayUtils.cameraRayFromInputObject(inputObject, distance, offset, camera)
11
21
  assert(inputObject, "Bad inputObject")
12
22
  offset = offset or Vector3.new()
@@ -14,6 +24,14 @@ function InputObjectRayUtils.cameraRayFromInputObject(inputObject, distance, off
14
24
  return InputObjectRayUtils.cameraRayFromScreenPosition(inputObject.Position + offset, distance, camera)
15
25
  end
16
26
 
27
+ --[=[
28
+ Computes a camera ray from the mouse
29
+ @param mouse Mouse
30
+ @param distance number
31
+ @param offset Vector3? -- Optional
32
+ @param camera Camera? -- Optional
33
+ @return Ray
34
+ ]=]
17
35
  function InputObjectRayUtils.cameraRayFromMouse(mouse, distance, offset, camera)
18
36
  assert(mouse, "Bad mouse")
19
37
  offset = offset or Vector3.new(0, 0, 0)
@@ -24,6 +42,13 @@ function InputObjectRayUtils.cameraRayFromMouse(mouse, distance, offset, camera)
24
42
  camera)
25
43
  end
26
44
 
45
+ --[=[
46
+ @param inputObject InputObject
47
+ @param distance number? -- Optional
48
+ @param offset Vector3
49
+ @param camera Camera? -- Optional
50
+ @return Ray
51
+ ]=]
27
52
  function InputObjectRayUtils.cameraRayFromInputObjectWithOffset(inputObject, distance, offset, camera)
28
53
  assert(inputObject, "Bad inputObject")
29
54
 
@@ -33,6 +58,12 @@ function InputObjectRayUtils.cameraRayFromInputObjectWithOffset(inputObject, dis
33
58
  camera)
34
59
  end
35
60
 
61
+ --[=[
62
+ @param position Vector3
63
+ @param distance number? -- Optional
64
+ @param camera Camera? -- Optional
65
+ @return Ray
66
+ ]=]
36
67
  function InputObjectRayUtils.cameraRayFromScreenPosition(position, distance, camera)
37
68
  distance = distance or DEFAULT_RAY_DISTANCE
38
69
  camera = camera or Workspace.CurrentCamera
@@ -41,6 +72,12 @@ function InputObjectRayUtils.cameraRayFromScreenPosition(position, distance, cam
41
72
  return Ray.new(baseRay.Origin, baseRay.Direction.unit * distance)
42
73
  end
43
74
 
75
+ --[=[
76
+ @param position Vector3
77
+ @param distance number? -- Optional
78
+ @param camera Camera? -- Optional
79
+ @return Ray
80
+ ]=]
44
81
  function InputObjectRayUtils.cameraRayFromViewportPosition(position, distance, camera)
45
82
  distance = distance or DEFAULT_RAY_DISTANCE
46
83
  camera = camera or Workspace.CurrentCamera
@@ -49,8 +86,13 @@ function InputObjectRayUtils.cameraRayFromViewportPosition(position, distance, c
49
86
  return Ray.new(baseRay.Origin, baseRay.Direction.unit * distance)
50
87
  end
51
88
 
52
-
53
- -- Generates a circle of rays including the center ray
89
+ --[=[
90
+ Generates a circle of rays including the center ray
91
+ @param ray Ray
92
+ @param count number
93
+ @param radius number
94
+ @return { Ray }
95
+ ]=]
54
96
  function InputObjectRayUtils.generateCircleRays(ray, count, radius)
55
97
  local rays = { }
56
98
 
@@ -1,5 +1,7 @@
1
- --- Provides utility functions involving input objects
2
- -- @module InputObjectUtils
1
+ --[=[
2
+ Provides utility functions involving input objects
3
+ @class InputObjectUtils
4
+ ]=]
3
5
 
4
6
  local InputObjectUtils = {}
5
7
 
@@ -11,12 +13,26 @@ local MOUSE_USER_INPUT_TYPES = {
11
13
  [Enum.UserInputType.MouseMovement] = true;
12
14
  }
13
15
 
16
+ --[=[
17
+ Returns whether a user input type involves the mouse.
18
+
19
+ @param userInputType UserInputType
20
+ @return true
21
+ ]=]
14
22
  function InputObjectUtils.isMouseUserInputType(userInputType)
15
23
  assert(typeof(userInputType) == "EnumItem", "Bad userInputType")
16
24
 
17
- return MOUSE_USER_INPUT_TYPES[userInputType]
25
+ return MOUSE_USER_INPUT_TYPES[userInputType] or false
18
26
  end
19
27
 
28
+ --[=[
29
+ Compares the two input objects and determines if they are the same thing. For example,
30
+ a finger being dragged across a screen, or a mouse input being used as a cursor.
31
+
32
+ @param inputObject InputObject
33
+ @param otherInputObject InputObject
34
+ @return boolean
35
+ ]=]
20
36
  function InputObjectUtils.isSameInputObject(inputObject, otherInputObject)
21
37
  assert(inputObject, "Bad inputObject")
22
38
  assert(otherInputObject, "Bad otherInputObject")