Skip to content

Commit

Permalink
- fixed a bug when trying to delete mousebuttons
Browse files Browse the repository at this point in the history
  • Loading branch information
1onar committed Nov 8, 2024
1 parent c47240b commit ec61cc2
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions MouseFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -440,22 +440,23 @@ local function GetCursorScaledPosition()
return x / scale, y / scale
end

local function DragOrSize(addon, Mousebutton)
local x, y = GetCursorScaledPosition()
if addon.mouse_locked then
local function DragOrSize(self, Mousebutton)
if self.mouse_locked then
return -- Do nothing if not MouseLocked is selected
end
addon:StartMoving()
addon.isMoving = true -- Add a flag to indicate the frame is being moved
if IsShiftKeyDown() then
addon.keys_mouse[addon] = nil
addon:Hide()

if Mousebutton == "LeftButton" and IsShiftKeyDown() then
self.keys_mouse = nil
self:Hide()
elseif Mousebutton == "LeftButton" then
self:StartMoving()
addon.isMoving = true -- Add a flag to indicate the frame is being moved
end
end

local function Release(addon, Mousebutton)
local function Release(self, Mousebutton)
if Mousebutton == "LeftButton" then
addon:StopMovingOrSizing()
self:StopMovingOrSizing()
addon.isMoving = false -- Reset the flag when the movement is stopped
end
end
Expand Down

0 comments on commit ec61cc2

Please sign in to comment.