WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Minimap won't move to edge of screen with mask (https://www.wowinterface.com/forums/showthread.php?t=56458)

Theroxis 07-26-18 10:43 PM

Minimap won't move to edge of screen with mask
 
So, I've gone ahead and created an alpha mask for my Minimap to make it rectangular, this works great.
I then wrote some lua to adjust the position of elements on the minimap, such as the mail icon, zone text, and clock. I also adjusted the hitbox of the minimap to match the new minimap shape, with the rectangular alpha map.
Finally, I went to adjust the minimap into the final desired location on screen... And it doesn't budge. The other elements work perfectly, just not the minimap itself.
Code:

--===============================================================================--
--MINIMAP TWEAKS: Rectangle, aesthetics
--===============================================================================--

function GetMinimapShape() return 'SQUARE' end
Minimap:SetFrameLevel(8)
Minimap:SetSize(280, 280)
MinimapBorderTop:Hide()
MinimapBorder:Hide()
Minimap:SetMaskTexture('Interface\\Addons\\UITweaks\\media\\mapmask')
Minimap:SetHitRectInsets(0, 0, 58, 58)
Minimap:ClearAllPoints()
Minimap:SetPoint("TOPRIGHT",UIParent,-5,50)
MinimapZoneText:SetWidth(Minimap:GetWidth()*0.9)
MinimapZoneText:ClearAllPoints()
MinimapZoneText:SetPoint("TOP",Minimap,"TOP",0,-60)
MinimapBackdrop:Hide()
MinimapBorder:Hide()
MinimapBorderTop:Hide()
MinimapZoomIn:Hide()
MinimapZoomOut:Hide()
GameTimeFrame:Hide()
MiniMapTracking:Hide()
MiniMapMailBorder:Hide()
MinimapNorthTag:SetAlpha(0)
MiniMapInstanceDifficulty:SetAlpha(0)
GuildInstanceDifficulty:SetAlpha(0)
MiniMapMailFrame:ClearAllPoints()
MiniMapMailFrame:SetPoint("BOTTOMLEFT",Minimap,"BOTTOMLEFT",-5,53)
MiniMapMailFrame:SetAlpha(0.8)


local blanktex = "Interface\\Buttons\\WHITE8x8"
local insetsize = 1 -- This is so you can perform arithmetic on the border size to configure the inset size.
local backdropcolor = {26/255, 25/255, 31/255}                -- backdrop color
local brdcolor = {0/255, 0/255, 0/255}                                -- backdrop border color

BorderFrame = CreateFrame("Frame", nil, UIParent)
BorderFrame:SetPoint("TOPLEFT", Minimap, "TOPLEFT", -1, -(58))
BorderFrame:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMRIGHT", 1, (58))       
BorderFrame:SetBackdrop(backdrop)
if not classColoredBorder then
        BorderFrame:SetBackdropBorderColor(unpack(brdcolor))
else
        BorderFrame:SetBackdropBorderColor(color.r, color.g, color.b)
end       
BorderFrame:SetBackdropColor(unpack(backdropcolor))
BorderFrame:SetFrameLevel(6)

Here's the situation, graphically:
https://imgur.com/a/WrmRkxg

The only change between those two screenshots is on this line:
Code:

Minimap:SetPoint("TOPRIGHT",UIParent,-5,50)

I've looked at other addons that provide a rectangular minimap and they don't seem to be doing anything special. I haven't tested that any of them exhibit the same behavior or not, though. It's like the minimap is bound on-screen for some reason and I can't figure out why... Any suggestions to fix this?

zork 07-27-18 03:12 AM

Have you checked the MinimapCluster via /fstack?
The cluster is parenting the Minimap.

Here is what I am doing with rMinimap. I use my own minimap mask too.
https://github.com/zorker/rothui/blo...p/core.lua#L29

Seerah 07-27-18 08:22 AM

The cluster should not affect the placement of the minimap if the position is being changed.

OP: You changed everything you could see, but you forget that the minimap is actually still a square, and is set to not go off-screen.

You can either turn that off, or allow it to go off by a predetermined amount.

Theroxis 07-27-18 10:48 AM

Quote:

Originally Posted by zork (Post 329077)
Have you checked the MinimapCluster via /fstack?
The cluster is parenting the Minimap.

Here is what I am doing with rMinimap. I use my own minimap mask too.
https://github.com/zorker/rothui/blo...p/core.lua#L29

Quote:

Originally Posted by Seerah (Post 329083)
The cluster should not affect the placement of the minimap if the position is being changed.

OP: You changed everything you could see, but you forget that the minimap is actually still a square, and is set to not go off-screen.

You can either turn that off, or allow it to go off by a predetermined amount.

Thanks for the help,
Moving the Minimap frame also moves the cluster frame, which is revealed by fstack appropriately. I also used /run print(Minimap:IsClampedToScreen()) as well as /run print(MinimapCluster:IsClampedToScreen()) which both return false. I went ahead and set the clamp rects appropriately (negative 58 on top and bottom to match the mask, 0 on left and right) anyways, as well as trying Minimap:SetClampedToScreen(false) and MinimapCluster:SetClampedToScreen(false), with no impact.

I also tried setting the parent of Minimap to WorldFrame instead of UIParent, but that just messed with the scale inheritance and nothing else.

I'll zip up just the minimap portion of this so people can play with it if they like, but it seems like I am limited to the constraints of the mask texture no matter what I try. For now I will settle for a stretched minimap that I can position where I want. It looks uglier, but at least it fits. This might be a limitation of the game engine, at this point.


Here's a link to what I have right now ( A bit ugly admittedly but I've been throwing the kitchen sink at it lol):
https://drive.google.com/open?id=1tW...VE4Qs4kD8bTSt7


All times are GMT -6. The time now is 06:01 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI