from retail

diffchecked
This commit is contained in:
NoM0Re
2025-01-26 19:24:17 +01:00
parent dcd0f833ac
commit 38533d0e99
7 changed files with 286 additions and 265 deletions
+19 -9
View File
@@ -200,9 +200,9 @@ local function modify(parent, region, data)
bgFile = SharedMedia:Fetch("background", data.borderBackdrop),
insets = {
left = data.borderInset,
right = data.borderInset,
top = data.borderInset,
bottom = data.borderInset,
right = data.borderInset,
top = data.borderInset,
bottom = data.borderInset,
},
});
border:SetBackdropBorderColor(data.borderColor[1], data.borderColor[2], data.borderColor[3], data.borderColor[4]);
@@ -244,18 +244,28 @@ local function modify(parent, region, data)
end
-- Rotate model
function region:Rotate(degrees)
region.rotation = degrees;
function region:SetAnimRotation(degrees)
region.animRotation = degrees
region:UpdateEffectiveRotation()
end
function region:SetRotation(degrees)
region.rotation = degrees
region:UpdateEffectiveRotation()
end
function region:UpdateEffectiveRotation()
region.effectiveRotation = region.animRotation or region.rotation
if region.model then
region.model:SetFacing(rad(region.rotation));
region.model:SetFacing(rad(region.effectiveRotation))
end
end
region:Rotate(data.rotation);
region:SetRotation(data.rotation)
-- Get model rotation
function region:GetRotation()
return region.rotation;
function region:GetBaseRotation()
return region.rotation
end
function region:PreShow()
+7 -2
View File
@@ -93,6 +93,7 @@ function Private.regionPrototype.AddProperties(properties, defaultsForRegion)
isPercent = true
}
end
if defaultsForRegion and defaultsForRegion.progressSource then
properties["progressSource"] = {
display = L["Progress Source"],
@@ -343,6 +344,7 @@ local function SetProgressSource(self, progressSource)
self.progressSource = progressSource
self:UpdateProgress()
end
local function SetAdjustedMin(self, adjustedMin)
local index = adjustedMin:find("%% *$")
if index then
@@ -355,6 +357,7 @@ local function SetAdjustedMin(self, adjustedMin)
end
self:UpdateProgress()
end
local function SetAdjustedMax(self, adjustedMax)
local index = adjustedMax:find("%% *$")
if index then
@@ -373,6 +376,7 @@ end
local function GetMinMaxProgress(self)
return self.minProgress or 0, self.maxProgress or 0
end
local function UpdateProgressFromState(self, minMaxConfig, state, progressSource)
local progressType = progressSource[2]
local property = progressSource[3]
@@ -467,6 +471,7 @@ local function UpdateProgressFromState(self, minMaxConfig, state, progressSource
else
adjustMin = 0
end
local max
if minMaxConfig.adjustedMax then
max = minMaxConfig.adjustedMax
@@ -879,7 +884,7 @@ function Private.regionPrototype.AddExpandFunction(data, region, cloneId, parent
if region:IsProtected() then
if InCombatLockdown() then
Private.AuraWarnings.UpdateWarning(uid, "protected_frame_error", "error",
L["Cannot change secure frame in combat lockdown. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"],
L["Cannot change secure frame in combat lockdown. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"],
true)
else
Private.AuraWarnings.UpdateWarning(uid, "protected_frame", "warning",
@@ -910,7 +915,7 @@ function Private.regionPrototype.AddExpandFunction(data, region, cloneId, parent
if region:IsProtected() then
if InCombatLockdown() then
Private.AuraWarnings.UpdateWarning(uid, "protected_frame_error", "error",
L["Cannot change secure frame in combat lockdown. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"],
L["Cannot change secure frame in combat lockdown. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Protected-Frames"],
true)
else
Private.AuraWarnings.UpdateWarning(uid, "protected_frame", "warning",
+5 -9
View File
@@ -18,10 +18,7 @@ local default = {
foregroundColor = {1, 1, 1, 1},
backgroundColor = {0.5, 0.5, 0.5, 0.5},
blendMode = "BLEND",
rotation = 0,
discrete_rotation = 0,
mirror = false,
rotate = true,
selfPoint = "CENTER",
anchorPoint = "CENTER",
anchorFrameType = "SCREEN",
@@ -181,8 +178,7 @@ local function SetProgress(self, progress)
if (frame > endFrame) then
frame = endFrame
end
end
if (frame < startFrame) then
frame = startFrame
end
@@ -251,8 +247,7 @@ local FrameTickFunctions = {
if (frame > endFrame) then
frame = endFrame
end
end
if (frame < startFrame) then
frame = startFrame
end
@@ -411,7 +406,8 @@ local function modify(parent, region, data)
region.background:SetBaseTexture(backgroundTexture);
region.background:SetFrame(backgroundTexture, region.backgroundFrame or 1);
region.background:SetDesaturated(data.desaturateBackground)
region.background:SetVertexColor(data.backgroundColor[1], data.backgroundColor[2], data.backgroundColor[3], data.backgroundColor[4]);
region.background:SetVertexColor(data.backgroundColor[1], data.backgroundColor[2],
data.backgroundColor[3], data.backgroundColor[4])
region.background:SetBlendMode(data.blendMode);
if (data.hideBackground) then
@@ -495,7 +491,6 @@ local function modify(parent, region, data)
function region:Update()
region:UpdateProgress()
end
elseif data.animationType == "progress" then
function region:Update()
region:UpdateProgress()
@@ -525,6 +520,7 @@ local function modify(parent, region, data)
self.FrameTick = FrameTickFunctions.progressTimer
self.subRegionEvents:AddSubscriber("FrameTick", self)
end
self:FrameTick()
end
+42 -40
View File
@@ -11,9 +11,8 @@ local default = {
color = {1, 1, 1, 1},
blendMode = "BLEND",
rotation = 0,
discrete_rotation = 0,
mirror = false,
rotate = true,
rotate = false,
selfPoint = "CENTER",
anchorPoint = "CENTER",
anchorFrameType = "SCREEN",
@@ -64,6 +63,15 @@ local properties = {
display = L["Mirror"],
setter = "SetMirror",
type = "bool"
},
rotation = {
display = L["Rotation"],
setter = "SetRotation",
type = "number",
min = 0,
max = 360,
bigStep = 1,
default = 0
}
}
@@ -85,6 +93,16 @@ local function create(parent)
return region;
end
local SQRT2 = sqrt(2)
local function GetRotatedPoints(degrees, scaleForFullRotate)
local angle = rad(135 - degrees);
local factor = scaleForFullRotate and 1 or SQRT2
local vx = math.cos(angle) / factor
local vy = math.sin(angle) / factor
return 0.5+vx,0.5-vy , 0.5-vy,0.5-vx , 0.5+vy,0.5+vx , 0.5-vx,0.5+vy
end
local function modify(parent, region, data)
Private.regionPrototype.modify(parent, region, data);
region.texture:SetDesaturated(data.desaturate)
@@ -95,16 +113,6 @@ local function modify(parent, region, data)
region.scalex = 1;
region.scaley = 1;
region.texture:SetBlendMode(data.blendMode);
--region.texture:SetRotation((data.rotation / 180) * math.pi);
local function GetRotatedPoints(degrees)
degrees = degrees or 0
local angle = rad(135 - degrees);
local vx = math.cos(angle);
local vy = math.sin(angle);
return 0.5+vx,0.5-vy , 0.5-vy,0.5-vx , 0.5+vy,0.5+vx , 0.5-vx,0.5+vy
end
region.mirror = data.mirror
@@ -113,20 +121,8 @@ local function modify(parent, region, data)
if(region.mirror) then
mirror_h = not mirror_h;
end
local ulx,uly , llx,lly , urx,ury , lrx,lry;
if(data.rotate) then
ulx,uly , llx,lly , urx,ury , lrx,lry = GetRotatedPoints(region.rotation);
else
if(data.discrete_rotation == 0 or data.discrete_rotation == 360) then
ulx,uly , llx,lly , urx,ury , lrx,lry = 0,0 , 0,1 , 1,0 , 1,1;
elseif(data.discrete_rotation == 90) then
ulx,uly , llx,lly , urx,ury , lrx,lry = 1,0 , 0,0 , 1,1 , 0,1;
elseif(data.discrete_rotation == 180) then
ulx,uly , llx,lly , urx,ury , lrx,lry = 1,1 , 1,0 , 0,1 , 0,0;
elseif(data.discrete_rotation == 270) then
ulx,uly , llx,lly , urx,ury , lrx,lry = 0,1 , 1,1 , 0,0 , 1,0;
end
end
local ulx,uly , llx,lly , urx,ury , lrx,lry
= GetRotatedPoints(region.effectiveRotation, data.rotate)
if(mirror_h) then
if(mirror_v) then
region.texture:SetTexCoord(lrx,lry , urx,ury , llx,lly , ulx,uly);
@@ -142,8 +138,8 @@ local function modify(parent, region, data)
end
end
region.rotation = data.rotation;
DoTexCoord();
region.rotation = data.rotation
region.effectiveRotation = region.rotation
function region:Scale(scalex, scaley)
region.scalex = scalex;
@@ -231,20 +227,26 @@ local function modify(parent, region, data)
region.texture:SetDesaturated(b);
end
if(data.rotate) then
function region:Rotate(degrees)
region.rotation = degrees;
DoTexCoord();
end
function region:GetRotation()
return region.rotation;
end
else
region.Rotate = nil;
region.GetRotation = nil;
function region:SetAnimRotation(degrees)
region.animRotation = degrees
region:UpdateEffectiveRotation()
end
function region:SetRotation(degrees)
region.rotation = degrees
region:UpdateEffectiveRotation()
end
function region:UpdateEffectiveRotation()
region.effectiveRotation = region.animRotation or region.rotation
DoTexCoord()
end
function region:GetBaseRotation()
return region.rotation
end
region:SetRotation(data.rotation)
Private.regionPrototype.modifyFinish(parent, region, data);
end