General Updates

- Fixed an error while scrolling down target npcs in the breakdown window.
- Fixed an error when clicking to open the Death Recap by Details!.
- End of Mythic Run panel got updates.
- Framework updated: new rounded tooltips.
This commit is contained in:
Tercio Jose
2024-01-12 23:56:55 -03:00
parent f078bd5296
commit 9c63b08895
20 changed files with 354 additions and 32 deletions
+51 -1
View File
@@ -15,7 +15,7 @@ local max = math.max
--api locals
local PixelUtil = PixelUtil or DFPixelUtil
local version = 18
local version = 19
local CONST_MENU_TYPE_MAINMENU = "main"
local CONST_MENU_TYPE_SUBMENU = "sub"
@@ -227,10 +227,23 @@ function DF:CreateCoolTip()
gameCooltip.defaultFont = DF:GetBestFontForLanguage()
gameCooltip.RoundedFramePreset = {
color = {.075, .075, .075, 1},
border_color = {.2, .2, .2, 1},
roundness = 8,
}
--create frames, self is frame1 or frame2
local createTooltipFrames = function(self)
self:SetSize(500, 500)
self:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
if (not self.HaveRoundedCorners) then
DF:AddRoundedCornersToFrame(self, gameCooltip.RoundedFramePreset)
self:DisableRoundedCorners()
self.HaveRoundedCorners = true
end
self:SetBackdrop(defaultBackdrop)
self:SetBackdropColor(DF:ParseColors(defaultBackdropColor))
self:SetBackdropBorderColor(DF:ParseColors(defaultBackdropBorderColor))
@@ -348,6 +361,33 @@ function DF:CreateCoolTip()
DF:CreateFlashAnimation(frame2)
end
function GameCooltip:ShowRoundedCorner()
if (not frame1.HaveRoundedCorners) then
return
end
frame1:EnableRoundedCorners()
frame2:EnableRoundedCorners()
frame1:SetBackdrop(nil)
frame2:SetBackdrop(nil)
frame1.frameBackgroundTexture:Hide()
frame2.frameBackgroundTexture:Hide()
end
function GameCooltip:HideRoundedCorner()
if (not frame1.HaveRoundedCorners) then
return
end
frame1:DisableRoundedCorners()
frame2:DisableRoundedCorners()
frame1.frameBackgroundTexture:Show()
frame2.frameBackgroundTexture:Show()
end
gameCooltip.frame1 = frame1
gameCooltip.frame2 = frame2
DF:FadeFrame(frame1, 0)
@@ -1929,6 +1969,8 @@ function DF:CreateCoolTip()
--mana range
--instant cooldown
gameCooltip:ShowRoundedCorner()
end
end
end
@@ -2628,6 +2670,10 @@ function DF:CreateCoolTip()
gameCooltip:HideSelectedTexture(frame1)
gameCooltip:HideSelectedTexture(frame2)
gameCooltip:HideRoundedCorner()
GameCooltip.frame1:SetBorderCornerColor(unpack(gameCooltip.RoundedFramePreset.border_color))
GameCooltip.frame2:SetBorderCornerColor(unpack(gameCooltip.RoundedFramePreset.border_color))
gameCooltip.FixedValue = nil
gameCooltip.HaveSubMenu = false
gameCooltip.SelectedIndexMain = nil
@@ -2704,6 +2750,8 @@ function DF:CreateCoolTip()
if (not fromPreset) then
gameCooltip:Preset(3, true)
end
GameCooltip:SetType("tooltip")
end
----------------------------------------------------------------------
@@ -2712,6 +2760,8 @@ function DF:CreateCoolTip()
function gameCooltip:AddMenu(menuType, func, param1, param2, param3, leftText, leftIcon, indexUp)
menuType = gameCooltip:ParseMenuType(menuType)
gameCooltip:SetType("menu")
if (leftText and indexUp and (menuType == CONST_MENU_TYPE_MAINMENU)) then
gameCooltip.Indexes = gameCooltip.Indexes + 1
if (not gameCooltip.IndexesSub[gameCooltip.Indexes]) then
+2 -3
View File
@@ -1,6 +1,6 @@
local dversion = 498
local dversion = 502
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
@@ -696,7 +696,7 @@ end
function DF.table.duplicate(t1, t2)
for key, value in pairs(t2) do
if (key ~= "__index" and key ~= "__newindex") then
--preserve a wowObject passing it to the new table with copying it
--preserve a UIObject passing it to the new table with copying it
if (type(value) == "table" and table.GetObjectType and table:GetObjectType()) then
t1[key] = value
@@ -2799,7 +2799,6 @@ function DF:CreateAnimation(animation, animationType, order, duration, arg1, arg
elseif (animationType == "ROTATION") then
anim:SetDegrees(arg1) --degree
--print("SetOrigin", arg2, arg3, arg4)
anim:SetOrigin(arg2 or "center", arg3 or 0, arg4 or 0) --point, x, y
elseif (animationType == "TRANSLATION") then
+1 -1
View File
@@ -291,7 +291,7 @@ detailsFramework:Mixin(LabelMetaFunctions, detailsFramework.ScriptHookMixin)
---create a new label object
---@param parent frame
---@param text string
---@param text string|table for used for localization, expects a locTable from the language system
---@param size number|nil
---@param color any|nil
---@param font string|nil
+2 -1
View File
@@ -60,9 +60,10 @@ detailsFramework.TooltipHandlerMixin = {
end
end
if (tooltipText) then
if (tooltipText and tooltipText ~= "") then
GameCooltip:Preset(2)
GameCooltip:AddLine(tooltipText)
GameCooltip:ShowRoundedCorner()
GameCooltip:ShowCooltip(getFrame(self), "tooltip")
end
end,
+42 -4
View File
@@ -4079,9 +4079,25 @@ detailsFramework.RadioGroupCoreFunctions = {
local checkbox = detailsFramework:CreateSwitch(self, function()end, false)
checkbox:SetTemplate(detailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"))
checkbox:SetAsCheckBox()
if (self.options.rounded_corner_preset) then
checkbox:SetBackdrop(nil)
detailsFramework:AddRoundedCornersToFrame(checkbox, self.options.rounded_corner_preset)
end
if (self.options.checked_texture) then
checkbox:SetCheckedTexture(self.options.checked_texture, self.options.checked_texture_offset_x, self.options.checked_texture_offset_y)
end
checkbox.Icon = detailsFramework:CreateImage(checkbox, "", 16, 16)
checkbox.Label = detailsFramework:CreateLabel(checkbox, "")
self.allCheckBoxes[#self.allCheckBoxes + 1] = checkbox
if (self.options.on_create_checkbox) then
--use dispatch
detailsFramework:QuickDispatch(self.options.on_create_checkbox, self, checkbox)
end
return checkbox
end,
@@ -4107,6 +4123,10 @@ detailsFramework.RadioGroupCoreFunctions = {
if (checkbox._callback) then
detailsFramework:QuickDispatch(checkbox._callback, fixedParam, checkbox._optionid)
end
if (radioGroup.options.on_click_option) then
detailsFramework:QuickDispatch(radioGroup.options.on_click_option, radioGroup, checkbox, fixedParam, checkbox._optionid)
end
end,
RefreshCheckbox = function(self, checkbox, optionTable, optionId)
@@ -4123,8 +4143,8 @@ detailsFramework.RadioGroupCoreFunctions = {
checkbox._optionid = optionId
checkbox:SetFixedParameter(optionTable.param or optionId)
local isChecked = type(optionTable.get) == "function" and detailsFramework:Dispatch(optionTable.get) or false
checkbox:SetValue(isChecked)
local bIsChecked = type(optionTable.get) == "function" and detailsFramework:Dispatch(optionTable.get) or false
checkbox:SetValue(bIsChecked)
checkbox.Label.text = optionTable.name
checkbox.Label.textsize = optionTable.text_size or self.options.text_size
@@ -4134,7 +4154,7 @@ detailsFramework.RadioGroupCoreFunctions = {
if (optionTable.texture) then
checkbox.Icon:SetTexture(optionTable.texture)
checkbox.Icon:SetSize(width, height)
checkbox.Icon:SetPoint("left", checkbox, "right", 2, 0)
checkbox.Icon:SetPoint("left", checkbox, "right", self.AnchorOptions.icon_offset_x, 0)
checkbox.Label:SetPoint("left", checkbox.Icon, "right", 2, 0)
checkbox.tooltip = optionTable.tooltip
@@ -4143,6 +4163,12 @@ detailsFramework.RadioGroupCoreFunctions = {
else
checkbox.Icon:SetTexCoord(0, 1, 0, 1)
end
if (optionTable.mask) then
checkbox.Icon:SetMask(optionTable.mask)
else
checkbox.Icon:SetMask(nil)
end
else
checkbox.Icon:SetTexture("")
checkbox.Label:SetPoint("left", checkbox, "right", 2, 0)
@@ -4177,7 +4203,19 @@ detailsFramework.RadioGroupCoreFunctions = {
totalWidth = math.max(self.AnchorOptions.min_width * #radioOptions, totalWidth)
end
self:SetSize(totalWidth, maxHeight)
if (not self.AnchorOptions.width) then
self:SetWidth(totalWidth)
else
self:SetWidth(self.AnchorOptions.width)
end
if (not self.AnchorOptions.height) then
self:SetHeight(maxHeight)
else
self:SetHeight(self.AnchorOptions.height)
end
self.AnchorOptions.start_y = -5
--sending false to automatically use the radio group children
self:ArrangeFrames(false, self.AnchorOptions)
+43
View File
@@ -74,6 +74,7 @@ local cornerNames = {"TopLeft", "TopRight", "BottomLeft", "BottomRight"}
---@field GetMaxFrameLevel fun(self:df_roundedpanel) : number --return the max frame level of the frame and its children
---@class df_roundedpanel : frame, df_roundedcornermixin, df_optionsmixin, df_titlebar
---@field disabled boolean
---@field bHasBorder boolean
---@field bHasTitleBar boolean
---@field options df_roundedpanel_options
@@ -286,6 +287,10 @@ detailsFramework.RoundedCornerPanelMixin = {
---adjust the size of the corner textures and the border edge textures
---@param self df_roundedpanel
OnSizeChanged = function(self)
if (self.disabled) then
return
end
--if the frame has a titlebar, need to adjust the size of the titlebar
if (self.bHasTitleBar) then
self.TitleBar:SetWidth(self:GetWidth() - 14)
@@ -351,6 +356,44 @@ detailsFramework.RoundedCornerPanelMixin = {
end
end,
DisableRoundedCorners = function(self)
self.TopLeft:Hide()
self.TopRight:Hide()
self.BottomLeft:Hide()
self.BottomRight:Hide()
self.CenterBlock:Hide()
self.TopEdgeBorder:Hide()
self.BottomEdgeBorder:Hide()
self.LeftEdgeBorder:Hide()
self.RightEdgeBorder:Hide()
self.TopLeftBorder:Hide()
self.TopRightBorder:Hide()
self.BottomLeftBorder:Hide()
self.BottomRightBorder:Hide()
self.TopHorizontalEdge:Hide()
self.BottomHorizontalEdge:Hide()
self.disabled = true
end,
EnableRoundedCorners = function(self)
self.TopLeft:Show()
self.TopRight:Show()
self.BottomLeft:Show()
self.BottomRight:Show()
self.CenterBlock:Show()
self.TopEdgeBorder:Show()
self.BottomEdgeBorder:Show()
self.LeftEdgeBorder:Show()
self.RightEdgeBorder:Show()
self.TopLeftBorder:Show()
self.TopRightBorder:Show()
self.BottomLeftBorder:Show()
self.BottomRightBorder:Show()
self.TopHorizontalEdge:Show()
self.BottomHorizontalEdge:Show()
self.disabled = false
end,
---get the size of the edge texture
---@param self df_roundedpanel
---@param alignment "vertical"|"horizontal"
+12
View File
@@ -885,6 +885,15 @@ local get_switch_func = function(self)
return self.OnSwitch
end
local setCheckedTexture = function(self, texture, xOffSet, yOffSet)
self.checked_texture:SetTexture(texture)
if (xOffSet or yOffSet) then
self.checked_texture:SetPoint("center", self.button, "center", xOffSet or -1, yOffSet or -1)
else
self.checked_texture:SetPoint("center", self.button, "center", -1, -1)
end
end
local set_as_checkbok = function(self)
if self.is_checkbox and self.checked_texture then return end
local checked = self:CreateTexture(self:GetName() .. "CheckTexture", "overlay")
@@ -894,6 +903,8 @@ local set_as_checkbok = function(self)
checked:SetSize(32 * size_pct, 32 * size_pct)
self.checked_texture = checked
self.SetCheckedTexture = setCheckedTexture
self._thumb:Hide()
self._text:Hide()
self.is_checkbox = true
@@ -928,6 +939,7 @@ end
---@field GetSwitchFunction fun(self:df_button):function
---@field SetSwitchFunction fun(self:df_button, newOnSwitchFunction: function)
---@field GetCapsule fun(self:df_button):df_button capsule only exists in the actual frame of the encapsulated widget
---@field SetCheckedTexture fun(self:df_button, texture:string)
function DF:CreateSwitch(parent, onSwitch, defaultValue, width, height, leftText, rightText, member, name, colorInverted, switchFunc, returnFunc, withLabel, switch_template, label_template)
+6
View File
@@ -462,12 +462,14 @@ detailsFramework.TextEntryCounter = detailsFramework.TextEntryCounter or 1
magnifyingGlassTexture:SetPoint("left", self.widget, "left", 4, 0)
magnifyingGlassTexture:SetSize(self:GetHeight()-10, self:GetHeight()-10)
magnifyingGlassTexture:SetAlpha(0.5)
self.MagnifyingGlassTexture = magnifyingGlassTexture
local searchFontString = self:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
searchFontString:SetText("search")
searchFontString:SetAlpha(0.3)
searchFontString:SetPoint("left", magnifyingGlassTexture, "right", 2, 0)
detailsFramework:SetFontSize(searchFontString, 10)
self.SearchFontString = searchFontString
local clearSearchButton = CreateFrame("button", nil, self.widget, "UIPanelCloseButton")
clearSearchButton:SetPoint("right", self.widget, "right", -3, 0)
@@ -477,6 +479,7 @@ detailsFramework.TextEntryCounter = detailsFramework.TextEntryCounter or 1
clearSearchButton:GetHighlightTexture():SetAtlas("common-search-clearbutton")
clearSearchButton:GetPushedTexture():SetAtlas("common-search-clearbutton")
clearSearchButton:Hide()
self.ClearSearchButton = clearSearchButton
clearSearchButton:SetScript("OnClick", function()
self:SetText("")
@@ -767,6 +770,9 @@ local AutoComplete_OnTextChanged = function(editboxWidget, byUser, capsule)
editboxWidget.ignore_textchange = nil
end
capsule.characters_count = chars_now
--call the other hooks for the widget
capsule:RunHooksForWidget("OnTextChanged", editboxWidget, byUser, capsule)
end
local AutoComplete_OnSpacePressed = function(editboxWidget, capsule)