Quantcast

Also auto switch colours to player talk colours for create self

Christopher Tse [09-01-20 - 22:25]
Also auto switch colours to player talk colours for create self

Also some minor UI fixes to the settings button sizes plus comments
Filename
ChatBubblePool.lua
MainFrame.lua
Settings.xml
diff --git a/ChatBubblePool.lua b/ChatBubblePool.lua
index c2f5224..401674e 100644
--- a/ChatBubblePool.lua
+++ b/ChatBubblePool.lua
@@ -133,6 +133,14 @@ end

 local function moveTail(tail)
 	--Note: Since the chat bubble is anchored to the WorldFrame, we shouldn't adjust for UIParent's scale
+
+	--Vectors Used
+	-- Cursor - The cursor's current X and Y screen coords
+	-- origPoint - Vector of tail's original location relative to its old anchoring point.
+	-- anchoringPointCoords - Vector of new anchoring point in world coords
+	-- oldAnchoringPointCoords - Vector of old anchoring point in world coords
+	-- origPointWorldCoords - Vector of tail's original location in world coords.
+
 	local cursorX, cursorY = GetCursorPosition();
 	local origPoint = tail.origPoint;
 	local bubble = tail:GetParent();
@@ -142,6 +150,13 @@ local function moveTail(tail)
 	local anchoringPointCoords = getAnchoringPointCoords(bubble, anchoringPoint);
 	local oldAnchoringPointCoords = getAnchoringPointCoords(bubble, origPoint.relativeP);
 	local origPointWorldCoords = addVector(origPoint, oldAnchoringPointCoords);
+
+	--In this part, we basically only move the x or y based on which side it is on.
+	--The other axis should remain at "0" (plus some offset to align the texture)
+	--This is so the tail remains attached to the bubble.
+
+	--We also bound the new X/Y so it doesn't go beyond the edge of the bubble.
+	--The minimum X/Y variable determines how much space to leave at the end of the bubble.
 	if closestEdge == "BOTTOM" or closestEdge == "TOP" then
 		local cursorOffset = cursorX - tail.origCursorLoc.x;
 		local newXinWorldCoords = origPointWorldCoords.x + cursorOffset;
diff --git a/MainFrame.lua b/MainFrame.lua
index 35248d8..4310cfa 100644
--- a/MainFrame.lua
+++ b/MainFrame.lua
@@ -115,19 +115,21 @@ function checkSmartTargetColoring()
 	if not settings.get("SMART_COLORING") then
 		return
 	end
-	if IsControlKeyDown() and SayColorSelected() then
+	if IsShiftKeyDown() or IsControlKeyDown() and SayColorSelected() then
 		if not smartTargetColoringActive then
 			smartTargetColoringActive = true;
 			savedColor = settings.get("SELECTED_COLOR");
 			savedRGB = settings.get("SELECTED_COLOR_RGB");
 		end

-		if UnitExists("target") then
+		if IsControlKeyDown() and UnitExists("target") then
 			if UnitIsPlayer("target") then
 				selectColor(nil,"Say",ChatTypeInfo["SAY"],nil);
 			else
 				selectColor(nil,"Say (NPC)",ChatTypeInfo["MONSTER_SAY"],nil);
 			end
+		elseif IsShiftKeyDown() then
+			selectColor(nil,"Say",ChatTypeInfo["SAY"],nil);
 		else
 			selectColor(nil,savedColor,savedRGB,nil);
 		end
diff --git a/Settings.xml b/Settings.xml
index a5983da..b61da2e 100644
--- a/Settings.xml
+++ b/Settings.xml
@@ -75,7 +75,7 @@
 						<Anchor point="TOPLEFT" x="25" y="-94" />
 					</Anchors>
 				</FontString>
-				<FontString name="SmartColoringLabel" inherits="GameFontHighlightLeft" text="Automatically switch between player and npc colours for Create (Target)">
+				<FontString name="SmartColoringLabel" inherits="GameFontHighlightLeft" text="Auto switch between player/npc colours when creating for target/self">
 					<Size x="462" y="20" />
 					<Anchors>
 						<Anchor point="TOPLEFT" x="25" y="-118" />
@@ -95,7 +95,7 @@
 				</Anchors>
 			</CheckButton>
 			<Button name="OkayButton" inherits="UIPanelButtonTemplate" text="Okay">
-				<Size x="245" y="23" />
+				<Size x="253" y="23" />
 				<Anchors>
 					<Anchor point="BOTTOMLEFT" x="17" y="21" />
 				</Anchors>
@@ -106,9 +106,9 @@
 				</Scripts>
 			</Button>
 			<Button name="CancelButton" inherits="UIPanelButtonTemplate" text="Cancel">
-				<Size x="214" y="23" />
+				<Size x="247" y="23" />
 				<Anchors>
-					<Anchor point="BOTTOMLEFT" x="268" y="21" />
+					<Anchor point="BOTTOMLEFT" x="276" y="21" />
 				</Anchors>
 				<Scripts>
 					<OnClick function="CancelSettings">