from retail
diffchecked
This commit is contained in:
@@ -27,9 +27,6 @@ local function createOptions(id, data)
|
||||
OptionsPrivate.OpenTexturePicker(data, paths, {
|
||||
texture = "texture",
|
||||
color = "color",
|
||||
rotate = "rotate",
|
||||
discrete_rotation = "discrete_rotation",
|
||||
rotation = "rotation",
|
||||
mirror = "mirror",
|
||||
blendMode = "blendMode"
|
||||
}, OptionsPrivate.Private.texture_types);
|
||||
@@ -39,55 +36,48 @@ local function createOptions(id, data)
|
||||
control = "WeakAurasIcon",
|
||||
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse",
|
||||
},
|
||||
desaturate = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Desaturate"],
|
||||
order = 2,
|
||||
},
|
||||
space2 = {
|
||||
type = "execute",
|
||||
name = "",
|
||||
width = WeakAuras.normalWidth,
|
||||
order = 5,
|
||||
image = function() return "", 0, 0 end,
|
||||
},
|
||||
color = {
|
||||
type = "color",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Color"],
|
||||
hasAlpha = true,
|
||||
order = 10
|
||||
order = 2
|
||||
},
|
||||
blendMode = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Blend Mode"],
|
||||
order = 12,
|
||||
values = OptionsPrivate.Private.blend_types
|
||||
},
|
||||
mirror = {
|
||||
desaturate = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Mirror"],
|
||||
order = 20
|
||||
name = L["Desaturate"],
|
||||
order = 3,
|
||||
},
|
||||
alpha = {
|
||||
type = "range",
|
||||
control = "WeakAurasSpinBox",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Alpha"],
|
||||
order = 25,
|
||||
order = 4,
|
||||
min = 0,
|
||||
max = 1,
|
||||
bigStep = 0.01,
|
||||
isPercent = true
|
||||
},
|
||||
blendMode = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Blend Mode"],
|
||||
order = 5,
|
||||
values = OptionsPrivate.Private.blend_types
|
||||
},
|
||||
mirror = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Mirror"],
|
||||
order = 6
|
||||
},
|
||||
rotate = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Allow Full Rotation"],
|
||||
order = 30
|
||||
order = 8,
|
||||
},
|
||||
rotation = {
|
||||
type = "range",
|
||||
@@ -98,19 +88,7 @@ local function createOptions(id, data)
|
||||
max = 360,
|
||||
step = 1,
|
||||
bigStep = 3,
|
||||
order = 35,
|
||||
hidden = function() return not data.rotate end
|
||||
},
|
||||
discrete_rotation = {
|
||||
type = "range",
|
||||
control = "WeakAurasSpinBox",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Discrete Rotation"],
|
||||
min = 0,
|
||||
max = 360,
|
||||
step = 90,
|
||||
order = 35,
|
||||
hidden = function() return data.rotate end
|
||||
order = 9,
|
||||
},
|
||||
endHeader = {
|
||||
type = "header",
|
||||
@@ -142,6 +120,17 @@ local function createThumbnail()
|
||||
return borderframe;
|
||||
end
|
||||
|
||||
local SQRT2 = sqrt(2)
|
||||
local function GetRotatedPoints(degrees, scaleForFullRotate)
|
||||
degrees = degrees or 0
|
||||
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 modifyThumbnail(parent, region, data, fullModify, size)
|
||||
size = size or 30;
|
||||
local scale;
|
||||
@@ -159,24 +148,7 @@ local function modifyThumbnail(parent, region, data, fullModify, size)
|
||||
region.texture:SetVertexColor(data.color[1], data.color[2], data.color[3], data.color[4]);
|
||||
region.texture:SetBlendMode(data.blendMode);
|
||||
|
||||
local ulx,uly , llx,lly , urx,ury , lrx,lry;
|
||||
if(data.rotate) then
|
||||
local angle = rad(135 - data.rotation);
|
||||
local vx = math.cos(angle);
|
||||
local vy = math.sin(angle);
|
||||
|
||||
ulx,uly , llx,lly , urx,ury , lrx,lry = 0.5+vx,0.5-vy , 0.5-vy,0.5-vx , 0.5+vy,0.5+vx , 0.5-vx,0.5+vy;
|
||||
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(data.rotation, data.rotate)
|
||||
if(data.mirror) then
|
||||
region.texture:SetTexCoord(urx,ury , lrx,lry , ulx,uly , llx,lly);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user