v0.506
+ Startup gathering fixed + Added Callbacks for unusual addon buttons + More support for RecipeRadar + fixed positional bugs of main button #5
This commit is contained in:
+70
-8
@@ -4,6 +4,10 @@ MBB_DragFlag = 0;
|
|||||||
MBB_ShowTimeout = -1;
|
MBB_ShowTimeout = -1;
|
||||||
MBB_Buttons = {};
|
MBB_Buttons = {};
|
||||||
MBB_Exclude = {};
|
MBB_Exclude = {};
|
||||||
|
MBB_DragPos ={
|
||||||
|
["orig"] = {},
|
||||||
|
["start"] = {}
|
||||||
|
};
|
||||||
MBB_DefaultOptions = {
|
MBB_DefaultOptions = {
|
||||||
["ButtonPos"] = {-18, -100},
|
["ButtonPos"] = {-18, -100},
|
||||||
["AttachToMinimap"] = 1,
|
["AttachToMinimap"] = 1,
|
||||||
@@ -80,8 +84,15 @@ MBB_ExtraSize = {
|
|||||||
end
|
end
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MBB_CallBack = {
|
||||||
|
["RecipeRadarMinimapButton"] = function()
|
||||||
|
RecipeRadar_MinimapButton_UpdatePosition();
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
_rescanned = false;
|
_rescanned = false;
|
||||||
_starttime = 0;
|
_starttime = GetTime();
|
||||||
|
|
||||||
function MBB_OnLoad()
|
function MBB_OnLoad()
|
||||||
this:RegisterEvent("VARIABLES_LOADED");
|
this:RegisterEvent("VARIABLES_LOADED");
|
||||||
@@ -362,6 +373,14 @@ function MBB_PrepareButton(name)
|
|||||||
end
|
end
|
||||||
end);
|
end);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if MBB_CallBack[name] then
|
||||||
|
|
||||||
|
MBB_Debug("Calling callback: ".. name)
|
||||||
|
local func = MBB_CallBack[name];
|
||||||
|
func();
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -486,10 +505,11 @@ function MBB_OnClick(arg1)
|
|||||||
if( arg1 and arg1 == "RightButton" and IsControlKeyDown() ) then
|
if( arg1 and arg1 == "RightButton" and IsControlKeyDown() ) then
|
||||||
if( MBB_Options.AttachToMinimap == 1 ) then
|
if( MBB_Options.AttachToMinimap == 1 ) then
|
||||||
local xpos,ypos = GetCursorPosition();
|
local xpos,ypos = GetCursorPosition();
|
||||||
local scale = Minimap:GetEffectiveScale();--UIParent:GetEffectiveScale(); --GetCVar("uiScale");
|
local scale = MBB_Options.Scale/100;--UIParent:GetEffectiveScale(); --GetCVar("uiScale");
|
||||||
|
MBB_Debug("cursor "..(xpos).." "..(ypos))
|
||||||
MBB_Options.AttachToMinimap = 0;
|
MBB_Options.AttachToMinimap = 0;
|
||||||
MBB_Options.ButtonPos ={xpos,ypos} --{(xpos/scale)-10, (ypos/scale)-10}
|
MBB_Options.ButtonPos ={xpos/scale ,ypos/scale } --{(xpos/scale)-10, (ypos/scale)-10}
|
||||||
MBB_Debug(" "..(xpos/scale-10).." "..(ypos/scale-10))
|
MBB_Debug("position "..(xpos/scale ).." "..(ypos/scale ))
|
||||||
--(xpos/scale)-10, (ypos/scale)-10};
|
--(xpos/scale)-10, (ypos/scale)-10};
|
||||||
MBB_SetButtonPosition();
|
MBB_SetButtonPosition();
|
||||||
else
|
else
|
||||||
@@ -510,6 +530,51 @@ function MBB_OnClick(arg1)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function MBB_DragStart()
|
||||||
|
if (IsShiftKeyDown()) then
|
||||||
|
GameTooltip:Hide();
|
||||||
|
MBB_ShowTimeout = 0;
|
||||||
|
MBB_DragFlag = 1;
|
||||||
|
if( MBB_Options.AttachToMinimap == 1 ) then
|
||||||
|
|
||||||
|
else
|
||||||
|
local _,_,_,xpos,ypos = this:GetPoint();
|
||||||
|
MBB_DragPos["orig"] = {xpos, ypos};
|
||||||
|
MBB_Debug("orig "..(MBB_DragPos.orig[1]).." "..(MBB_DragPos.orig[2]))
|
||||||
|
this:StartMoving();
|
||||||
|
_,_,_,xpos,ypos = this:GetPoint();
|
||||||
|
MBB_DragPos["start"]= {xpos, ypos};
|
||||||
|
MBB_Debug("start "..(MBB_DragPos.start[1]).." "..(MBB_DragPos.start[2]))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
MBB_DragFlag = 0;
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function MBB_DragStop()
|
||||||
|
if MBB_DragFlag == 1 then
|
||||||
|
local _,_,_,xpos,ypos = this:GetPoint();
|
||||||
|
MBB_Debug("stop "..(xpos).." "..(ypos))
|
||||||
|
if( MBB_Options.AttachToMinimap == 1 ) then
|
||||||
|
|
||||||
|
|
||||||
|
MBB_Options.ButtonPos = {xpos,ypos};
|
||||||
|
else
|
||||||
|
this:StopMovingOrSizing();
|
||||||
|
|
||||||
|
-- local xpos,ypos = GetCursorPosition();
|
||||||
|
-- local scale = MBB_Options.Scale/100;
|
||||||
|
-- MBB_Options.ButtonPos ={xpos/scale ,ypos/scale }
|
||||||
|
xpos = MBB_DragPos.orig[1] + (xpos - MBB_DragPos.start[1])
|
||||||
|
ypos = MBB_DragPos.orig[2] + (ypos - MBB_DragPos.start[2])
|
||||||
|
MBB_Options.ButtonPos ={xpos ,ypos }
|
||||||
|
MBB_Debug("options "..(MBB_Options.ButtonPos[1]).." "..(MBB_Options.ButtonPos[2]))
|
||||||
|
end
|
||||||
|
MBB_DragFlag = 0;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function MBB_HideButtons()
|
function MBB_HideButtons()
|
||||||
MBB_ShowTimeout = -1;
|
MBB_ShowTimeout = -1;
|
||||||
for i,name in ipairs(MBB_Buttons) do
|
for i,name in ipairs(MBB_Buttons) do
|
||||||
@@ -520,15 +585,12 @@ end
|
|||||||
|
|
||||||
function MBB_OnUpdate(elapsed)
|
function MBB_OnUpdate(elapsed)
|
||||||
|
|
||||||
if (not _rescanned) then
|
if (not _rescanned and (GetTime() - _starttime) > 5) then
|
||||||
if ((GetTime() - _starttime) > 10) then
|
|
||||||
_rescanned = true;
|
_rescanned = true;
|
||||||
MBB_GatherIcons();
|
MBB_GatherIcons();
|
||||||
MBB_SetButtonPosition();
|
MBB_SetButtonPosition();
|
||||||
return;
|
return;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
if( MBB_DragFlag == 1 and MBB_Options.AttachToMinimap == 1 ) then
|
if( MBB_DragFlag == 1 and MBB_Options.AttachToMinimap == 1 ) then
|
||||||
local xpos,ypos = GetCursorPosition();
|
local xpos,ypos = GetCursorPosition();
|
||||||
|
|||||||
+2
-22
@@ -77,30 +77,10 @@
|
|||||||
GameTooltip:Hide();
|
GameTooltip:Hide();
|
||||||
</OnLeave>
|
</OnLeave>
|
||||||
<OnDragStart>
|
<OnDragStart>
|
||||||
if (IsShiftKeyDown()) then
|
MBB_DragStart();
|
||||||
GameTooltip:Hide();
|
|
||||||
MBB_ShowTimeout = 0;
|
|
||||||
if( MBB_Options.AttachToMinimap == 1 ) then
|
|
||||||
MBB_DragFlag = 1;
|
|
||||||
else
|
|
||||||
this:StartMoving();
|
|
||||||
end
|
|
||||||
end
|
|
||||||
</OnDragStart>
|
</OnDragStart>
|
||||||
<OnDragStop>
|
<OnDragStop>
|
||||||
|
MBB_DragStop();
|
||||||
if( MBB_Options.AttachToMinimap == 1 ) then
|
|
||||||
MBB_DragFlag = 0;
|
|
||||||
local _,_,_,xpos,ypos = this:GetPoint();
|
|
||||||
MBB_Options.ButtonPos = {xpos,ypos};
|
|
||||||
else
|
|
||||||
this:StopMovingOrSizing();
|
|
||||||
local xpos,ypos = GetCursorPosition();
|
|
||||||
MBB_Options.ButtonPos = {xpos,ypos};
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</OnDragStop>
|
</OnDragStop>
|
||||||
<OnUpdate>
|
<OnUpdate>
|
||||||
MBB_OnUpdate(arg1);
|
MBB_OnUpdate(arg1);
|
||||||
|
|||||||
@@ -23,6 +23,13 @@ Use Right click on the MinimapButtonBag button to open the options dialog.
|
|||||||
|
|
||||||
#Last changes
|
#Last changes
|
||||||
|
|
||||||
|
v0.506
|
||||||
|
|
||||||
|
+ Startup gathering fixed
|
||||||
|
+ Added Callbacks for unusual addon buttons
|
||||||
|
+ More support for RecipeRadar
|
||||||
|
+ fixed positional bugs of main button #5
|
||||||
|
|
||||||
v0.505
|
v0.505
|
||||||
|
|
||||||
+ Added button's scale option
|
+ Added button's scale option
|
||||||
|
|||||||
Reference in New Issue
Block a user