function self:SetGradientExtraWidth(value)
local x = 6 - value
self.GradientM:SetPoint("TOPLEFT", self.Label, "TOPLEFT", x, 0);
self.GradientM:SetPoint("BOTTOMRIGHT", self.Label, "BOTTOMRIGHT", -x, 0);
end
local maxWidth = 128;
function self:SetText(text)
self.Label:SetText();
self.Label:SetWidth(0);
self.Label:SetText(text);
if self.Label:GetWidth() > maxWidth then
self.Label:SetWidth(maxWidth);
end
end
UIFrameFadeIn(self, 0.2, 0, 1);
NarciAPI.NineSliceUtil.SetUpBackdrop(self, "dispersiveShadow");
local mx, my = self:GetParent():GetParent():GetCenter();
local px, py = GetCursorPosition()
local scale = self:GetParent():GetParent():GetEffectiveScale()
px, py = px/scale, py/scale
self:GetParent():SetPoint("CENTER", px-mx, py-my)
self:GetParent():Show();
self:GetParent():Hide();
self:GetParent():Hide();
self.OppoDirection = false;
self.Width = self:GetParent():GetWidth();
self.TimeSinceLastUpdate = 0;
self.anchorPoint, self.relativeTo, self.relativePoint, self.toX, self.toY = self:GetParent():GetPoint();
self.defaultX = self.toX;
local _;
self:GetParent():Show()
_, _, _, self.fromX, self.fromY = self:GetParent():GetPoint();
self.TimeSinceLastUpdate = 0;
self.OppoDirection = not self.OppoDirection;
self.t = 0;
self.t = 0;
self.VirtualThumb:SetTexCoord(0, 0.5, 0, 1);
if not self:IsDraggingThumb() then
self.VirtualThumb:SetTexCoord(0.5, 1, 0, 1);
end
if not self:IsMouseOver(8, -8, 0, 0) then
self.VirtualThumb:SetTexCoord(0.5, 1, 0, 1);
end
self.ThumbBorder:SetColorTexture(1, 1, 1);
self.ThumbBorder:SetColorTexture(0.3, 0.3, 0.3);
self.VirtualThumb:SetPoint("CENTER", self.Thumb, "CENTER", 0, 0)
if value ~= self.oldValue then
self.oldValue = value;
local decimal;
if self.decimal and self.decimal > 0 then
decimal = 1/self.decimal;
else
decimal = 0;
end
value = math.floor(value *decimal + 0.5) / decimal;
self.KeyLabel:SetText(value);
if self.func then
self.func(value);
end
end
self.isOn = false;
self.Highlight:Show();
if self.isOn then return; end
self.Highlight:Hide();
self:StopAnimating();
self:Hide();
self:SetAlpha(0);
self.anchor = nil;
self:Hide();
if self.Text:GetWidth() > 220 then
self.Text:SetWidth(220);
end
self:SetHeight(math.max(48, self.Text:GetHeight() + 36));
self:SetWidth(self.Text:GetWidth() + 48);
NarciAPI_FadeFrame(self:GetParent(), 0.35, "OUT");
self.Text:SetTextColor(1, 0, 0)
local function OnUpdate(self)
local _, y = self:GetCenter();
if not self.y then
self.y = y;
else
local diffY = math.abs(y - self.y);
if diffY > 10 then
self.Counter:Stop();
self:SetScript("OnUpdate", function()
return;
end)
end
end
end
self.OnUpdateFunc = OnUpdate;
self:UpdateFrameSize();
local t = 2; --Duration changes with text length
self:StopAnimating();
self.Counter:SetScript("OnStop", function(self)
NarciAPI_FadeFrame(self:GetParent(), 0.35, "OUT");
end)
self.Counter.Duration:SetDuration(t);
self.Counter:Play();
self:SetFrameStrata("TOOLTIP");
self:SetScript("OnUpdate", self.OnUpdateFunc);
self.Counter:SetScript("OnStop", function()
return;
end)
self:StopAnimating();
self:StopAnimating();
if self:IsVisible() then
self.Counter:SetScript("OnStop", function(self)
NarciAPI_FadeFrame(self:GetParent(), 0.35, "OUT");
end)
self:SetScript("OnUpdate", self.OnUpdateFunc);
self.Counter.Duration:SetDuration(2);
self.Counter:Play();
end
self.x, self.y = nil, nil;
self:StopAnimating();
self:Hide();
self.Text:SetSize(0, 0);
self.Text:SetText("")
self:SetAlpha(0);
self:ClearAllPoints();
self:SetParent(nil);
self.anchor = nil;
if self:IsEnabled() then
SetCursor("Interface/CURSOR/Cast.blp");
end
SetCursor("Interface/CURSOR/Point.blp");
self:ClearFocus();
self:HighlightText(0,0);
Narci.UserIsInputing = true;
Narci.UserIsInputing = false;
self:HighlightText(0,0);
self:ClearFocus();
self:ClearFocus();
self:GetParent():SetTexCoord(0, 1, 0, 1);
self:GetParent().flyInDown:Play();
self:GetParent():SetTexCoord(0, 1, 1, 0);
self:GetParent().flyInUp:Play();
self:Initialize(20, true);
self.numLines = 0;
self:HighlightText(0, 0);
self:ClearFocus();
self:RegisterForDrag("LeftButton");
self:StartMoving();
self:StopMovingOrSizing();
local timer = self:GetParent():GetParent();
if timer.isLoop and (not timer.isPaused) then
self:GetParent().animFill:Play();
end
if self.onFinishedFunc then
self.onFinishedFunc();
end
self:GetParent().animFade:Play();
if self.onFinishedFunc then
self.onFinishedFunc();
end
self:GetParent():SetText( SEARCH );
self:GetParent().FadeIn:Play();
self.Icon:SetTexCoord(0.75, 1, 0.75, 1);
self:GetParent():ClearText(true);
self.Icon:SetAlpha(1);
self.Icon:SetAlpha(0.5);
self.Icon:SetSize(18, 18);
self.Icon:SetSize(20, 20);
return;
if self.isEditing then
self:GetParent():SetFocus();
end
NarciAPI.NineSliceUtil.SetUpBackdrop(self, "photoModeUIBorder");
self:GetParent():Hide();
self:GetParent():Hide();
self:GetParent():GetParent():OnEnter();
self:GetParent():GetParent():OnLeave();
self:GetParent():OnTimerFinished();