Quantcast

Merge pull request #23 from tekHudson/fix-bar-reset-on-lock

Tek Hudson [01-10-20 - 16:01]
Merge pull request #23 from tekHudson/fix-bar-reset-on-lock

Fix bar reset on lock
Filename
DruidBar.lua
DruidBar.xml
diff --git a/DruidBar.lua b/DruidBar.lua
index b4f815e..637a67c 100644
--- a/DruidBar.lua
+++ b/DruidBar.lua
@@ -271,7 +271,6 @@ function dbarLength()

 	DruidBarMana:SetWidth(DruidBarKey.width*0.95);
 	DruidBarManaBackground:SetWidth(DruidBarKey.width*0.95);
-	DruidBarDontMove:SetWidth(DruidBarKey.width*0.95);
 end

 function dbarHeight()
@@ -284,7 +283,6 @@ function dbarHeight()

 	DruidBarMana:SetHeight(DruidBarKey.height*(2/3));
 	DruidBarManaBackground:SetHeight(DruidBarKey.height*(2/3));
-	DruidBarDontMove:SetHeight(DruidBarKey.height*(2/3));
 end

 function Minimap_Button_Renderer()
@@ -327,21 +325,16 @@ function DruidBar_MainGraphics()

 		-- Set the position lock and dragability
 		if DruidBarKey.Lock then
-			dbarShow(DruidBarDontMove);
 			DruidBarFrame:EnableMouse(0);
-			DruidBarFrame:SetMovable(false)
-			DruidBarFrame:RegisterForDrag()
+			DruidBarFrame:RegisterForDrag();
 		else
-			dbarHide(DruidBarDontMove);
 			DruidBarFrame:EnableMouse(1);
-			DruidBarFrame:SetMovable(true)
-			DruidBarFrame:RegisterForDrag("LeftButton")
-			DruidBarFrame:SetScript("OnDragStart", DruidBarFrame.StartMoving)
-			DruidBarFrame:SetScript("OnDragStop", DruidBarFrame.StopMovingOrSizing)
+			DruidBarFrame:RegisterForDrag("LeftButton");
+			DruidBarFrame:SetScript("OnDragStart", DruidBarFrame.StartMoving);
+			DruidBarFrame:SetScript("OnDragStop", DruidBarFrame.StopMovingOrSizing);
 		end
 	else
 		dbarHide(DruidBarFrame);
-		dbarHide(DruidBarDontMove);
 	end
 end

@@ -351,7 +344,7 @@ function DruidBar_TextRenderer()
 	dbarHide(DruidBarTextRight);

 	-- Text options --
-	if DruidBarKey.Text or (not DruidBarKey.Text and MouseIsOver(DruidBarDontMove)) then
+	if DruidBarKey.Text or (not DruidBarKey.Text) then
 		if DruidBarKey.Percent then
 			if DruidBarKey.Percent == 0 then -- Numbers
 				dbarShow(DruidBarTextCenter);
@@ -407,7 +400,6 @@ function DruidBar_ReplaceGraphics()
 	if UnitPowerType("player") ~= 0 then
 		dbarShow(DruidBarFrame);
 		dbarHide(DruidBarManaBackground);
-		dbarHide(DruidBarDontMove);
 		dbarHide(DruidBarBorder);
 		dbarHide(DruidBarTextLeft);
 		dbarHide(DruidBarTextCenter);
diff --git a/DruidBar.xml b/DruidBar.xml
index a908f6a..514828a 100644
--- a/DruidBar.xml
+++ b/DruidBar.xml
@@ -115,20 +115,6 @@
 		</Scripts>
 	</Frame>

-	<Button name="DruidBarDontMove" frameStrata="TOOLTIP" toplevel="true" parent="DruidBarFrame" enableMouse="false" movable="false" hidden="true">
-		<Size>
-			<AbsDimension x="170" y="18"/>
-		</Size>
-
-		<Anchors>
-			<Anchor point="CENTER" relativeTo="$parent" relativePoint="CENTER">
-				<Offset>
-					<AbsDimension x="0" y="0"/>
-				</Offset>
-			</Anchor>
-		</Anchors>
-	</Button>
-
 	<Frame name="DruidBarReplaceText" frameStrata="LOW" enableMouse="true" movable="false" parent="UIParent" hidden="true">
 		<Size>
 			<AbsDimension x="120" y="10"/>