From 5f58d0d1771328e9f4b9737c7a9d11886429cd9a Mon Sep 17 00:00:00 2001 From: Bunny67 Date: Sun, 23 Aug 2020 18:22:28 +0300 Subject: [PATCH] remove rotateText --- WeakAuras/RegionTypes/AuraBar.lua | 3 - WeakAuras/SubRegionTypes/SubText.lua | 80 +------------------ WeakAurasOptions/RegionOptions/AuraBar.lua | 7 -- WeakAurasOptions/SubRegionOptions/SubText.lua | 21 +---- 4 files changed, 4 insertions(+), 107 deletions(-) diff --git a/WeakAuras/RegionTypes/AuraBar.lua b/WeakAuras/RegionTypes/AuraBar.lua index ba14527..0226e63 100644 --- a/WeakAuras/RegionTypes/AuraBar.lua +++ b/WeakAuras/RegionTypes/AuraBar.lua @@ -1053,9 +1053,6 @@ local function modify(parent, region, data) end region:Color(data.barColor[1], data.barColor[2], data.barColor[3], data.barColor[4]); - -- Rotate text - local textDegrees = data.rotateText == "LEFT" and 90 or data.rotateText == "RIGHT" and -90 or 0; - -- Update icon visibility if region.iconVisible then -- Update icon diff --git a/WeakAuras/SubRegionTypes/SubText.lua b/WeakAuras/SubRegionTypes/SubText.lua index 80ae879..d1ead86 100644 --- a/WeakAuras/SubRegionTypes/SubText.lua +++ b/WeakAuras/SubRegionTypes/SubText.lua @@ -28,7 +28,6 @@ local default = function(parentType) text_shadowColor = { 0, 0, 0, 1}, text_shadowXOffset = 0, text_shadowYOffset = 0, - rotateText = "NONE", text_automaticWidth = "Auto", text_fixedWidth = 64, @@ -53,7 +52,6 @@ local default = function(parentType) text_shadowColor = { 0, 0, 0, 1}, text_shadowXOffset = 1, text_shadowYOffset = -1, - rotateText = "NONE", text_automaticWidth = "Auto", text_fixedWidth = 64, @@ -101,64 +99,6 @@ local properties = { }, } - --- Rotate object around its origin -local function animRotate(object, degrees, anchor) - if (not anchor) then - anchor = "CENTER"; - end - -- Something to rotate - if object.animationGroup or degrees ~= 0 then - -- Create AnimationGroup and rotation animation - object.animationGroup = object.animationGroup or object:CreateAnimationGroup(); - local group = object.animationGroup; - group.rotate = group.rotate or group:CreateAnimation("rotation"); - local rotate = group.rotate; - - if rotate:GetDegrees() == degrees and rotate:GetOrigin() == anchor then - return - end - - rotate:SetOrigin(anchor, 0, 0); - rotate:SetDegrees(degrees); - rotate:SetDuration(0); - rotate:SetEndDelay(2147483647); - group:Play(); - rotate:SetSmoothProgress(1); - group:Pause(); - end -end - --- Calculate offset after rotation -local function getRotateOffset(object, degrees, point) - -- Any rotation at all? - if degrees ~= 0 then - -- Basic offset - local originoffset = object:GetStringHeight() / 2; - local xo = -1 * originoffset * sin(degrees); - local yo = originoffset * (cos(degrees) - 1); - - -- Alignment dependant offset - if point:find("BOTTOM", 1, true) then - yo = yo + (1 - cos(degrees)) * (object:GetStringWidth() / 2 - originoffset); - elseif point:find("TOP", 1, true) then - yo = yo - (1 - cos(degrees)) * (object:GetStringWidth() / 2 - originoffset); - end - if point:find("RIGHT", 1, true) then - xo = xo + (1 - cos(degrees)) * (object:GetStringWidth() / 2 - originoffset); - elseif point:find("LEFT", 1, true) then - xo = xo - (1 - cos(degrees)) * (object:GetStringWidth() / 2 - originoffset); - end - - -- Done - return xo, yo; - - -- No rotation - else - return 0, 0; - end -end - local function create() local region = CreateFrame("FRAME", nil, UIParent); @@ -275,7 +215,6 @@ local function modify(parent, region, parentData, data, first) if text:GetFont() then text:SetText(WeakAuras.ReplaceRaidMarkerSymbols(textStr)) end - region:UpdateAnchorOnTextChange() end end @@ -359,7 +298,6 @@ local function modify(parent, region, parentData, data, first) local fontPath = SharedMedia:Fetch("font", data.text_font); region.text:SetFont(fontPath, size < 33 and size or 33, data.text_fontType); region.text:SetTextHeight(size) - region:UpdateAnchorOnTextChange(); end function region:SetVisible(visible) @@ -400,21 +338,11 @@ local function modify(parent, region, parentData, data, first) region.text_anchorXOffset = data.text_anchorXOffset region.text_anchorYOffset = data.text_anchorYOffset - local textDegrees = data.rotateText == "LEFT" and 90 or data.rotateText == "RIGHT" and -90 or 0; - region.UpdateAnchor = function(self) - local xo, yo = getRotateOffset(text, textDegrees, selfPoint) - parent:AnchorSubRegion(text, "point", selfPoint, data.text_anchorPoint, (self.text_anchorXOffset or 0) + xo, (self.text_anchorYOffset or 0) + yo) + parent:AnchorSubRegion(text, "point", selfPoint, data.text_anchorPoint, self.text_anchorXOffset or 0, self.text_anchorYOffset or 0) end region:UpdateAnchor() - animRotate(text, textDegrees, selfPoint) - - if textDegrees == 0 then - region.UpdateAnchorOnTextChange = function() end - else - region.UpdateAnchorOnTextChange = region.UpdateAnchor - end region.SetXOffset = function(self, xOffset) if self.text_anchorXOffset == xOffset then @@ -453,8 +381,6 @@ local function addDefaultsForNewAura(data) text_shadowColor = { 0, 0, 0, 1}, text_shadowXOffset = 1, text_shadowYOffset = -1, - - rotateText = "NONE", }); tinsert(data.subRegions, { @@ -475,8 +401,6 @@ local function addDefaultsForNewAura(data) text_shadowColor = { 0, 0, 0, 1}, text_shadowXOffset = 1, text_shadowYOffset = -1, - - rotateText = "NONE", }); elseif data.regionType == "icon" then tinsert(data.subRegions, { @@ -497,8 +421,6 @@ local function addDefaultsForNewAura(data) text_shadowColor = { 0, 0, 0, 1}, text_shadowXOffset = 0, text_shadowYOffset = 0, - - rotateText = "NONE", }); end end diff --git a/WeakAurasOptions/RegionOptions/AuraBar.lua b/WeakAurasOptions/RegionOptions/AuraBar.lua index b701b22..335f8b0 100644 --- a/WeakAurasOptions/RegionOptions/AuraBar.lua +++ b/WeakAurasOptions/RegionOptions/AuraBar.lua @@ -52,12 +52,6 @@ local function createOptions(id, data) data.width = data.height; data.height = temp; data.icon_side = data.icon_side == "LEFT" and "RIGHT" or "LEFT"; - - if(data.rotateText == "LEFT" or data.rotateText == "RIGHT") then - data.rotateText = "NONE"; - elseif(data.rotateText == "NONE") then - data.rotateText = "LEFT" - end end data.orientation = v; @@ -601,7 +595,6 @@ local templates = { width = 30, height = 200, barColor = { 0, 1, 0, 1}, - rotateText = "LEFT", orientation = "VERTICAL_INVERSE", inverse = true, } diff --git a/WeakAurasOptions/SubRegionOptions/SubText.lua b/WeakAurasOptions/SubRegionOptions/SubText.lua index 28fce9b..4644f40 100644 --- a/WeakAurasOptions/SubRegionOptions/SubText.lua +++ b/WeakAurasOptions/SubRegionOptions/SubText.lua @@ -112,13 +112,6 @@ local function createOptions(parentData, data, index, subIndex) textJustify = " " .. L["and aligned right"] end - local textRotate = "" - if data.rotateText == "LEFT" then - textRotate = " " .. L["and rotated left"] - elseif data.rotateText == "RIGHT" then - textRotate = " " .. L["and rotated right"] - end - local textWidth = "" if data.text_automaticWidth == "Fixed" then local wordWarp = "" @@ -130,7 +123,7 @@ local function createOptions(parentData, data, index, subIndex) textWidth = " "..L["and with width |cFFFF0000%s|r and %s"]:format(data.text_fixedWidth, wordWarp) end - local secondline = L["|cFFffcc00Font Flags:|r |cFFFF0000%s|r and shadow |c%sColor|r with offset |cFFFF0000%s/%s|r%s%s%s"]:format(textFlags, color, data.text_shadowXOffset, data.text_shadowYOffset, textRotate, textJustify, textWidth) + local secondline = L["|cFFffcc00Font Flags:|r |cFFFF0000%s|r and shadow |c%sColor|r with offset |cFFFF0000%s/%s|r%s%s%s"]:format(textFlags, color, data.text_shadowXOffset, data.text_shadowYOffset, "", textJustify, textWidth) return secondline end, @@ -208,20 +201,12 @@ local function createOptions(parentData, data, index, subIndex) hidden = hiddenFontExtra, width = indentWidth }, - rotateText = { - type = "select", - width = WeakAuras.normalWidth - indentWidth, - name = L["Rotate Text"], - values = WeakAuras.text_rotate_types, - order = 50, - hidden = hiddenFontExtra - }, text_justify = { type = "select", - width = WeakAuras.normalWidth, + width = WeakAuras.normalWidth - indentWidth, name = L["Alignment"], values = WeakAuras.justify_types, - order = 50.5, + order = 50, hidden = hiddenFontExtra }, text_font_space5 = {