diff --git a/modules/input/Mouse.lua b/modules/input/Mouse.lua index 4f58ec15..c37be961 100644 --- a/modules/input/Mouse.lua +++ b/modules/input/Mouse.lua @@ -2,8 +2,8 @@ -- Stephen Leitnick -- November 07, 2020 -local Trove = require(script.Parent.Parent.Trove) local Signal = require(script.Parent.Parent.Signal) +local Trove = require(script.Parent.Parent.Trove) local UserInputService = game:GetService("UserInputService") @@ -42,6 +42,14 @@ Mouse.__index = Mouse @prop RightUp Signal @tag Event ]=] +--[=[ + @within Mouse + @prop Moved Signal + @tag Event + ```lua + mouse.Moved:Connect(function(position) ... end) + ``` +]=] --[=[ @within Mouse @prop Scrolled Signal @@ -70,6 +78,7 @@ function Mouse.new() self.RightDown = self._trove:Construct(Signal) self.RightUp = self._trove:Construct(Signal) self.Scrolled = self._trove:Construct(Signal) + self.Moved = self._trove:Construct(Signal) self._trove:Connect(UserInputService.InputBegan, function(input, processed) if processed then @@ -97,7 +106,10 @@ function Mouse.new() if processed then return end - if input.UserInputType == Enum.UserInputType.MouseWheel then + if input.UserInputType == Enum.UserInputType.MouseMovement then + local position = input.Position + self.Moved:Fire(Vector2.new(position.X, position.Y)) + elseif input.UserInputType == Enum.UserInputType.MouseWheel then self.Scrolled:Fire(input.Position.Z) end end) diff --git a/modules/input/wally.toml b/modules/input/wally.toml index 7ca48b93..0869fa2e 100644 --- a/modules/input/wally.toml +++ b/modules/input/wally.toml @@ -1,7 +1,7 @@ [package] name = "sleitnick/input" description = "Basic input classes" -version = "2.1.1" +version = "2.2.0" license = "MIT" authors = ["Stephen Leitnick"] registry = "https://github.com/UpliftGames/wally-index"