Skip to content

Commit

Permalink
[Feature] Un-anchor frames when dragging them
Browse files Browse the repository at this point in the history
  • Loading branch information
Krealle committed Sep 10, 2024
1 parent a7e11b3 commit cec4b5f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions UnitFrames/EditMode.lua
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,16 @@ local function CreateOverlayBox(button, unit)
CUF:Fire("UpdateLayout", nil, "position", const.UNIT.TARGET)
end

if Util:ButtonIsAnchoredToParent(unit) then
CUF.DB.CurrentLayoutTable()[unit].anchorToParent = false
CUF:Fire("UpdateLayout", nil, "position", unit)
end

if Util:ButtonIsMirrored(unit) then
CUF.DB.CurrentLayoutTable()[unit].mirrorPlayer = false
CUF:Fire("UpdateLayout", nil, "position", unit)
end

UpdatePositioningPopup()
end)

Expand Down
10 changes: 10 additions & 0 deletions Util/Utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,16 @@ function Util:IsPropSameType(a, b)
return type(a) == type(b)
end

---@param unit Unit
function Util:ButtonIsAnchoredToParent(unit)
return DB.CurrentLayoutTable()[unit].anchorToParent
end

---@param unit Unit
function Util:ButtonIsMirrored(unit)
return DB.CurrentLayoutTable()[unit].mirrorPlayer
end

-------------------------------------------------
-- MARK: Frames
-------------------------------------------------
Expand Down

0 comments on commit cec4b5f

Please sign in to comment.