Skip to content
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

Conversation

juemrami
Copy link
Collaborator

@juemrami juemrami commented Aug 20, 2024

Related Issues:

In this PR

  • adds a UseLibDBIcon option as "Manage minimap button using LibDBIcon".
    • only available when the user has LibDBIcon-1.0 installed.
    • disabled by default, unless the user currently has the "Minimize minimap button distance" (lockDistance) option, which attaches the button to the edge of minimap when enabled.
  • Better aligns our minimap button with LibDBIcon-1.0 buttons if any exist (notably when the UseLibDBIcon is not enabled).
  • Minimap button can no longer be dragged off the right side of the screen when not anchored to the Minimap.
    • note: If the minimap button is managed by the LibDBIcon-1.0, it cannot be dragged away from the edge of the minimap at all.
  • Renamed button frame from "Lib_GPI_Minimap_"..TOCNAME to TOCNAME.."MinimapButton"

Images:

  • (new setting)
  • WowClassic_uQ41NujKUa
  • (unmanaged button aligning with LibDBIcons)
  • WowClassicT_87n5MYJRsg

Comment on lines 34 to +39
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
Copy link
Collaborator Author

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)

Comment on lines +197 to +201
if MinimapButton.isUsingLibDBIcon then --[[position updates handled by LibDBIcon]] return end;

local radiusOffset = LibDBIcon and LibDBIcon.radius or 10 -- better align with any LibDBIcons.
Copy link
Collaborator Author

@juemrami juemrami Aug 20, 2024

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)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before (slightly higher than LibDBIcons):
image
After (inline):
image

@juemrami juemrami force-pushed the 08-19-_hotfix_positioning_tweaks_for_the_minimap_button branch from 4f8e394 to 8fbdb72 Compare August 20, 2024 23:13
@juemrami juemrami marked this pull request as ready for review August 20, 2024 23:43
…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.
@juemrami juemrami force-pushed the 08-19-_hotfix_positioning_tweaks_for_the_minimap_button branch from 8fbdb72 to 0ab7450 Compare August 21, 2024 03:37
@juemrami juemrami merged commit 7f025e9 into Vysci:main Aug 21, 2024
@juemrami juemrami deleted the 08-19-_hotfix_positioning_tweaks_for_the_minimap_button branch August 21, 2024 18:41
@juemrami juemrami linked an issue Aug 21, 2024 that may be closed by this pull request
@juemrami juemrami linked an issue Aug 29, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use LibDBIcon-1.0 for Minimap Button Minimap button never stays in one place
1 participant