Quantcast

- Tweaks when user changes Titan scaling.

urnati [06-02-23 - 00:37]
- Tweaks when user changes Titan scaling.
Filename
Titan/Titan.lua
Titan/TitanConfig.lua
diff --git a/Titan/Titan.lua b/Titan/Titan.lua
index 309313e..699c137 100644
--- a/Titan/Titan.lua
+++ b/Titan/Titan.lua
@@ -1128,7 +1128,7 @@ VAR:  None
 OUT:  None
 --]]
 local function CheckBarBounds(self, width)
-	local trace = false
+	local trace = false -- true false
 	local result = {}
 		result.ok = true
 		result.err = ""
@@ -1145,7 +1145,7 @@ local function CheckBarBounds(self, width)
 		if trace then
 			print("Bounds"
 			.." "..tostring(bar_name)..""
-			.." "..tostring(self:GetLeft() or nil)..""
+			.." "..tostring(width)..""
 			)
 		end

@@ -1155,18 +1155,18 @@ local function CheckBarBounds(self, width)
 		local screen_top_scaled = screen.scaled_y
 		local screen_right = screen.x
 		local screen_top = screen.y
+		local screen_right_t = screen.x * tscale
+		local screen_top_t = screen.y * tscale

-		-- Assumes BOTTOMLEFT of screen per Short bar defaults.
-		-- Top and right adjust an addition pixel,
-		-- if resolution is not 'pixel perfect' rounding could cause algorithm to think bar is off screen

-		--- Back out the Titan scaling to get 'real' position within unscaled WoW window
+		-- Apply the Titan scaling to get 'real' position within WoW window;
 		-- Use floor to trunc decimal places where the side could be right on the edge of the screen.
-		local orig_w = self:GetWidth()
-		local l_off = math.floor(self:GetLeft()) -- * tscale)
-		local r_off = math.floor(self:GetRight()) -- * tscale)
-		local t_off = math.floor(self:GetTop()) -- * tscale)
-		local b_off = math.floor(self:GetBottom()) -- * tscale)
+		local orig_w = self:GetWidth() -- * tscale --math.floor(self:GetWidth() * tscale)
+		local l_off = math.floor(self:GetLeft() * tscale)
+		local r_off = math.floor(self:GetRight() * tscale)
+		local t_off = math.floor(self:GetTop() * tscale)
+		local b_off = math.floor(self:GetBottom() * tscale)
+		local hght = math.floor(t_off - b_off)

 		if trace then
 			print(">Bounds"
@@ -1175,9 +1175,13 @@ local function CheckBarBounds(self, width)
 			.." R "..tostring(format("%0.1f", r_off))..""
 			.." T "..tostring(format("%0.1f", t_off))..""
 			.." B "..tostring(format("%0.1f", b_off))..""
---			.."\n"
-			.." S "..tostring(format("%0.1f", screen_right))..""
-			.." x "..tostring(format("%0.1f", screen_top))..""
+			.." W "..tostring(format("%0.1f", orig_w))..""
+			.." H "..tostring(format("%0.1f", hght))..""
+			.."\n"
+			.." SR "..tostring(format("%0.1f", screen_right))..""
+			.." ST "..tostring(format("%0.1f", screen_top))..""
+			.." SR_t "..tostring(format("%0.1f", screen_right_t))..""
+			.." ST_t "..tostring(format("%0.1f", screen_top_t))..""
 			)
 		end

@@ -1190,7 +1194,10 @@ local function CheckBarBounds(self, width)
 		x_off = l_off
 		y_off = b_off

-		if (width == 0) then -- drag and drop
+		if (width == 0) then -- drag & drop OR entry / reload
+			-- Assumes BOTTOMLEFT of screen per Short bar defaults.
+			-- if resolution is not 'pixel perfect' rounding could cause algorithm to think bar is off screen
+
 			-- Keep the width
 			w_off = orig_w

@@ -1198,7 +1205,6 @@ local function CheckBarBounds(self, width)
 				x_off = 0
 				err = "Off left of screen, snap to edge"
 			elseif (r_off) > screen_right then
---				x_off = math.floor(l_off - math.abs((r_off - screen_right)))
 				x_off = math.floor(screen_right - (r_off - l_off))
 				err = "Off right side of screen, snap to edge"
 			end
@@ -1212,7 +1218,6 @@ local function CheckBarBounds(self, width)
 			end
 			err = ""
 			if (t_off) > screen_top then
---				y_off = math.floor(b_off - ((t_off) - screen_top))
 				y_off = math.floor(screen_top - (t_off - b_off))
 				err = "Off top of screen, snap to edge"
 			elseif b_off < 0 then
@@ -1240,7 +1245,7 @@ local function CheckBarBounds(self, width)
 			elseif w_new > max_w then
 				w_off = max_w
 				err = "Width too big. Set to max width." -- too wide
-			elseif x_off + w_new > screen_right then
+			elseif x_off + (w_new * tscale) > screen_right then
 				w_off = orig_w
 				err = "Off right of screen, snap to edge"
 			else
@@ -1251,7 +1256,10 @@ local function CheckBarBounds(self, width)
 --			self:SetWidth(w_off)
 		end

-		-- Offsets are saved in without scale
+		-- Back out Titan scaling
+		x_off = x_off / tscale
+		y_off = y_off / tscale
+		w_off = w_off --/ tscale
 		TitanVariables_SetBarPos(self, false, x_off, y_off, w_off)

 		if trace then
diff --git a/Titan/TitanConfig.lua b/Titan/TitanConfig.lua
index 9a141a2..04212ee 100644
--- a/Titan/TitanConfig.lua
+++ b/Titan/TitanConfig.lua
@@ -27,20 +27,35 @@ Highlight - notes. tips. and details

 --]]
 local notes = ""
-	..TitanUtils_GetNormalText(""
-		.."- This is a major update which includes Short Bars; revamped Config screens; and other new features.\n"
-		.."\n"
-		.."- Titan Bag : Opening bags is still an option until taint issue is resolved.\n"
+do
+notes = notes
+	..TitanUtils_GetGoldText("Major update :\n")
+	..TitanUtils_GetHighlightText(""
+	.."- This is a major update which includes Short Bars; revamped Config screens; and other new features.\n"
+	.."\n")
+	..TitanUtils_GetGoldText("DOWNGRADING From Titan 7.xx to 6.xx :\n")
+	..TitanUtils_GetHighlightText(""
+		.."- Prior to downgrading, move *any* plugins on a Short bar to one of the original full width Titan Bars or Hide the plugin. Titan 6.xx will throw an error if ANY plugin is assigned to ANY Short Bar. If Titan throws an error after a downgrade, wipe the Titan saved variables.\n"
 		)
+	.."\n\n"
+	..TitanUtils_GetGoldText("Notes:\n")
+	..TitanUtils_GetHighlightText(""
+	.."- Changing Titan Scaling : Short bars will move on screen. They should not go off screen. Move Short bars to desired location. You may have to Reset the SHort bar or temporarily disalbe top ot bottom bars to drag the Short bar.\n"
+	..TitanUtils_GetGoldText("Known Issues:\n")
+	..TitanUtils_GetHighlightText(""
+	.."- Titan Bag : Opening bags is still an option until taint issue is resolved.\n"
+	)
+end
+
 local changes = ""
 do -- recent change history
 changes = changes
 	..TitanUtils_GetGoldText("7.01.00.100007 : 2023/05/28\n")
 	..TitanUtils_GetGreenText("Titan : \n")
 	..TitanUtils_GetHighlightText(""
-		.."- Update TOC\n"
-		.."- Release Beta as mainline Titan. Includes all 7.x changes,\n"
-		.."- NEW : Config > Frame Adjust - Adjust one frame that holds widgets such as BG score, Telredor in Outlads, etc.\n"
+		.."- Release Beta as mainline Titan. Includes all 6.x changes.\n"
+		.."- Pet battles : Also hide bottom bars if shown,\n"
+		.."- NEW : Config > Frame Adjust - Allow user to adjust frame that holds widgets such as BG score, Telredor in Outlands, etc.\n"
 		)
 	.."\n\n"
 	..TitanUtils_GetGoldText("7.00.03.100007 : 2023/05/07\n")
@@ -2477,10 +2492,28 @@ local slashHelp = {
 local help_text = ""
 do -- set help_text
 help_text = ""
+	..TitanUtils_GetGreenText("Plugins: \n")
+	..TitanUtils_GetGoldText("Show / Hide Plugins :")
+	..TitanUtils_GetHighlightText(""
+		.." Use one of the methods below:\n"
+		.."- Open the right-click Bar menu; find the plugin in a category then click to toggle Show on the plugin.\n"
+		.."- Open Titan Configuration > Plugins then select the plugin by name then toggle Show. Uuse the Bar dropdown to select the Bar the plugin should be on.\n"
+		)
+	..TitanUtils_GetGoldText("Moving Plugins :")
+	..TitanUtils_GetHighlightText(""
+		.." Use one of the methods below:\n"
+		.."- Open the right-click Bar menu of the Bar you want the plugin on; find the plugin in a category then toggle Show. If plugin is already shown on another Bar then toggle again to have it appear in this Bar.\n"
+		.."- Drag and drop on another bar or on the same bar.\n"
+		.."- Drag and drop on another plugin to swap the plugins.\n"
+		.."- Open Titan Configuration > Plugins then toggle Show. Use the Bar dropdown and Right / Left buttons to place the plugin as desired.\n"
+		)
+	.."\n\n"
 	..TitanUtils_GetGreenText("Short Bars: \n")
 	..TitanUtils_GetHighlightText(""
 		.."Short bars are 10 shorter Titan bars that the user can place and change width.\n"
 		.."- Short bars are independent. They may be used with or without the full width Titan bars.\n"
+		.."- Titan does not restrict plugins to fit within the visible width (background). Using Configuration, plugins can be assigned well beyond the visible side. This may be desirable for some users.\n"
+		.."- Setting a plugin to right-side will use the visible right side (background); and may overlap with left or center aligned plugins.\n"
 		)
 	..TitanUtils_GetGoldText("Enable :\n")
 	..TitanUtils_GetHighlightText(""
@@ -2491,6 +2524,7 @@ help_text = ""
 	..TitanUtils_GetHighlightText(""
 		.."- Change width by 1 : Use Shift + mouse wheel.\n"
 		.."- Change width by 10: Use Shift + Ctrl + mouse wheel.\n"
+		.."- WIll not go beyond right side of screen.\n"
 		)
 	..TitanUtils_GetGoldText("Move :\n")
 	..TitanUtils_GetHighlightText(""
@@ -2498,13 +2532,13 @@ help_text = ""
 		.."- When dragging, best to place your mouse over the left side padding before moving or changing width.\n"
 		.."- When dragging stops, if the Short Bar is beyond the screen edge the Short Bar should 'snap' to the edge.\n"
 		)
-	..TitanUtils_GetGoldText("Skin :\n")
+	..TitanUtils_GetGoldText("Reset :\n")
 	..TitanUtils_GetHighlightText(""
-		.."- Can select Skin per Short bar BUT only the 'top' skin is used; some skins have a different top & bottom.\n"
+		.." In case a Short bar gets messed up, use Config > Bar > <Pick the Bar> then click Reset Position to place it at original position and width.\n"
 		)
-	..TitanUtils_GetGoldText("Reset :\n")
+	..TitanUtils_GetGoldText("Skin :\n")
 	..TitanUtils_GetHighlightText(""
-		.." In case a Short bar gets messed up, use Reset Position to place it at original position and width. This does not move plugins.\n"
+		.."- Can select Skin per Short bar BUT only the 'top' skin is used; some skins have a different top & bottom.\n"
 		)
 	..TitanUtils_GetGoldText("Limitations :\n")
 	..TitanUtils_GetHighlightText(""
@@ -2513,17 +2547,10 @@ help_text = ""
 		.."- There is no 'snap together' or grid for placing Short Bars.\n"
 		.."\n"
 		)
-	..TitanUtils_GetGoldText("DOWNGRADING :\n")
-	..TitanUtils_GetHighlightText(""
-		.."- From Titan 7.xx to 6.xx - Prior to downgrading, move *any* plugins on a Short bar to one of the original full width Titan Bars or Hide the plugin. Titan 6.xx will throw an error if ANY plugin is assigned to ANY Short Bar. If Titan throws an error after a downgrade, wipe the Titan saved variables.\n"
-		)
-	.."\n\n"
 	..TitanUtils_GetGreenText("All Bars: \n")
 	..TitanUtils_GetHighlightText(""
-		.."- Bar Right click menu shows the name of the Bar in the menu title corresponding to configuration options.\n"
+		.."- Bar Right click menu shows the name of the Bar in the menu title. Same name in configuration options.\n"
 		.."- Hide any Titan bar by using the Bar Right click menu then click Hide.\n"
-		.."- Titan does not restrict plugins to fit within the visible width. Using Configuration, plugins can be assigned well beyond the visible side. This may be desirable for some users.\n"
-		.."- Setting a plugin to right-side will use the visible right side; and may overlap with left or center aligned plugins.\n"
 		)
 	..TitanUtils_GetGoldText("Skins :\n")
 	..TitanUtils_GetHighlightText(""
@@ -2545,22 +2572,6 @@ help_text = ""
 		.."- Short 01 - 10 : User placed\n"
 		)
 	.."\n\n"
-	..TitanUtils_GetGreenText("Plugins: \n")
-	..TitanUtils_GetGoldText("Show / Hide Plugins :")
-	..TitanUtils_GetHighlightText(""
-		.." Use one of the methods below:\n"
-		.."- Open the right-click Bar menu; find the plugin in a category then click to toggle Show on the plugin.\n"
-		.."- Open Titan Configuration > Plugins then select the plugin by name then toggle Show. Uuse the Bar dropdown to select the Bar the plugin should be on.\n"
-		)
-	..TitanUtils_GetGoldText("Moving Plugins :")
-	..TitanUtils_GetHighlightText(""
-		.." Use one of the methods below:\n"
-		.."- Open the right-click Bar menu of the Bar you want the plugin on; find the plugin in a category then toggle Show. If plugin is already shown on another Bar then toggle again to have it appear in this Bar.\n"
-		.."- Drag and drop on another bar or on the same bar.\n"
-		.."- Drag and drop on another plugin to swap the plugins.\n"
-		.."- Open Titan Configuration > Plugins then toggle Show. Use the Bar dropdown and Right / Left buttons to place the plugin as desired.\n"
-		)
-	.."\n\n"
 end
 --[[ local
 NAME: helpBars