-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat][hotfix]: Improved compatibility with LibDBIcon-1.0
minimap buttons
#302
[feat][hotfix]: Improved compatibility with LibDBIcon-1.0
minimap buttons
#302
Conversation
if button.Lib_GPI_MinimapButton.db.lockDistance then | ||
dist=1 | ||
button.Lib_GPI_MinimapButton.db.distance = 1 -- locked the perimeter of minimap | ||
else | ||
if dist<1 then dist=1 elseif dist>2 then dist=2 end | ||
local radius = (Minimap:GetWidth() / 2) + 5; | ||
local dist = math.sqrt(dx*dx+dy*dy) / radius | ||
button.Lib_GPI_MinimapButton.db.distance = Clamp(dist, 1, 2) -- clamp the distance ratio between 1 and 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this math into the conditional to only be used when necessary (onUpdate
functions run every frame)
if MinimapButton.isUsingLibDBIcon then --[[position updates handled by LibDBIcon]] return end; | ||
|
||
local radiusOffset = LibDBIcon and LibDBIcon.radius or 10 -- better align with any LibDBIcons. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if LibDBIcon
is available and the user is not using it to manage the minimap button, then we should still try to match thier radius
value to better align. Otherwise we can fallback to 10
(resulting in the button sitting on the edge instead of through it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4f8e394
to
8fbdb72
Compare
…uttons - adds a `UseLibDBIcon` option available when the user has `LibDBIcon-1.0` installed which lets LibDBIcon handle the minimap button. - disabled by default, unless the user currently has the `lockDistance`` option enabled which attaches the minimap button to the minimap. - ![WowClassic_uQ41NujKUa](https://github.com/user-attachments/assets/5619a479-3c72-46f4-bf3d-f32ab9783255) - Better aligns our minimap button with LibDBIcon-1.0 buttons if any exist. - Minimap button can no longer be dragged off the right side of the screen when not anchored to the Minimap.
8fbdb72
to
0ab7450
Compare
Related Issues:
In this PR
UseLibDBIcon
option as "Manage minimap button using LibDBIcon".LibDBIcon-1.0
installed.lockDistance
) option, which attaches the button to the edge of minimap when enabled.UseLibDBIcon
is not enabled).LibDBIcon-1.0
, it cannot be dragged away from the edge of the minimap at all."Lib_GPI_Minimap_"..TOCNAME
toTOCNAME.."MinimapButton"
Images: