Skip to content

Commit

Permalink
fixe frame strata of minimap icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Pazza committed Jun 17, 2020
1 parent 479a4f2 commit 0219005
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Modules/MinimapIcon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,27 +107,27 @@ local function getFreePoints(x, y)
local width = _G.UIParent:GetWidth()*scale;
local height = _G.UIParent:GetHeight()*scale;
local point;

-- set limits to cursor position. We want to stay on the screen.
x = math.min(width, math.max(x, 0));
y = math.min(height, math.max(y, 0));

--determine TOP or BOTTOM
if(y > height/2) then
point = "TOP";
y = y - height;
else
point = "BOTTOM";
end

--determine LEFT or RIGHT
if(x < width/2) then
point = point.."LEFT";
else
point = point.."RIGHT";
x = x - width;
end

return point, x, y;
end

Expand Down Expand Up @@ -253,10 +253,10 @@ local function createMinimapIcon()
self.icon:SetTexCoord(0.05, 0.95, 0.05, 0.95);
end
icon.OnEnter = function(self)

end
icon.OnLeave = function(self)

end
icon.OnDragStart = function(self)
self.dragging = true;
Expand Down Expand Up @@ -296,7 +296,7 @@ local function createMinimapIcon()
local scale = _G.UIParent:GetEffectiveScale();
self:SetPoint("CENTER", _G.UIParent, free.point, free.x/scale, free.y/scale)
else
self:SetFrameStrata("BACKGROUND");
self:SetFrameStrata(_G.Minimap:GetFrameStrata());
self:SetParent(_G.Minimap);
self:SetFrameLevel(8);
local angle = math.rad(db.minimap.position or random(0, 360));
Expand Down Expand Up @@ -352,16 +352,16 @@ local function createMinimapIcon()
end
end
icon:Load();

local helperFrame = _G.CreateFrame("Frame");
helperFrame:SetScript("OnUpdate", function(self)
if(not icon.dragging and not icon.registeredForDrag and IsShiftKeyDown() and GetMouseFocus() == icon) then
icon.registeredForDrag = true;
icon:RegisterForDrag('LeftButton');
end
end);


dPrint("MinimapIcon Created...");
return icon;
end
Expand Down Expand Up @@ -471,7 +471,7 @@ local minimapMenu = AddContextMenu(info.text, info);
info.text = L["Enable"].." WIM";
info.func = function() SetEnabled(not db.enabled); end;
info.notCheckable = true;
minimapMenu:AddSubItem(AddContextMenu("ENABLE_DISABLE_WIM", info));
minimapMenu:AddSubItem(AddContextMenu("ENABLE_DISABLE_WIM", info));

--------------------------------------
-- Global Extensions to WIM --
Expand Down

0 comments on commit 0219005

Please sign in to comment.