- Added scale options.

- New API: instance:GetRealSize() return the width and height scaled.
- New API: instance:GetPositionOnScreen() return the window x, y position on screen.
- New API: instance:SetWindowScale (scale) set the window scale.
- New API: instance:IsGroupedWith (instance) return if self is groupped with instance.
- New API: instance:GetInstanceGroup([,instance id]) return a table with instance in the group.
This commit is contained in:
tercio
2014-10-03 16:53:42 -03:00
parent 635d3eba65
commit 28de6a9065
10 changed files with 227 additions and 58 deletions
+27 -3
View File
@@ -644,13 +644,18 @@ function _detalhes:EstaAgrupada (esta_instancia, lado) --> lado //// 1 = encosto
end
function _detalhes:BaseFrameSnap()
for meu_id, instancia in _ipairs (_detalhes.tabela_instancias) do
if (instancia:IsAtiva()) then
instancia.baseframe:ClearAllPoints()
end
end
local group = self:GetInstanceGroup()
local scale = self.window_scale
for _, instance in _ipairs (group) do
instance:SetWindowScale (scale)
end
local my_baseframe = self.baseframe
for lado, snap_to in _pairs (self.snap) do
--print ("DEBUG instancia " .. snap_to .. " lado "..lado)
@@ -774,12 +779,14 @@ end
function _detalhes:agrupar_janelas (lados)
local instancia = self
for lado, esta_instancia in _pairs (lados) do
if (esta_instancia) then
instancia.baseframe:ClearAllPoints()
esta_instancia = _detalhes.tabela_instancias [esta_instancia]
instancia:SetWindowScale (esta_instancia.window_scale)
if (lado == 3) then --> direita
--> mover frame
instancia.baseframe:SetPoint ("TOPRIGHT", esta_instancia.baseframe, "TOPLEFT")
@@ -1624,7 +1631,24 @@ function _detalhes:SetBackgroundAlpha (alpha)
end
function _detalhes:GetSize()
return self.bgframe:GetWidth(), self.bgframe:GetHeight()
return self.baseframe:GetWidth(), self.baseframe:GetHeight()
end
function _detalhes:GetRealSize()
return self.baseframe:GetWidth() * self.baseframe:GetScale(), self.baseframe:GetHeight() * self.baseframe:GetScale()
end
function _detalhes:GetPositionOnScreen()
local xOfs, yOfs = self.baseframe:GetCenter()
if (not xOfs) then
return
end
-- credits to ckknight (http://www.curseforge.com/profiles/ckknight/)
local _scale = self.baseframe:GetEffectiveScale()
local _UIscale = UIParent:GetScale()
xOfs = xOfs*_scale - GetScreenWidth()*_UIscale/2
yOfs = yOfs*_scale - GetScreenHeight()*_UIscale/2
return xOfs/_UIscale, yOfs/_UIscale
end
--> alias
+2
View File
@@ -45,6 +45,8 @@ _detalhes.instance_defaults = {
--skin
skin = "Minimalistic v2",
--scale
window_scale = 1.0,
--baseframe backdrop
bg_alpha = 0.7,
bg_r = 0.0941,