Skip to content

Commit

Permalink
Scalebar fix (framework)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Mar 5, 2022
1 parent af62ebb commit 3ee7da5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local dversion = 289
local dversion = 290
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)

Expand Down
31 changes: 21 additions & 10 deletions Libs/DF/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1982,7 +1982,7 @@ local SimplePanel_frame_backdrop_border_color = {0, 0, 0, 1}

--with_label was making the frame stay in place while its parent moves
--the slider was anchoring to with_label and here here were anchoring the slider again
function DF:CreateScaleBar(frame, config)
function DF:CreateScaleBar(frame, config) --~scale
local scaleBar, text = DF:CreateSlider(frame, 120, 14, 0.6, 1.6, 0.1, config.scale, true, "ScaleBar", nil, "Scale:", DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE"), DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE"))
scaleBar.thumb:SetWidth(24)
scaleBar:SetValueStep(0.1)
Expand Down Expand Up @@ -2056,6 +2056,14 @@ function DF:CreateScaleBar(frame, config)
editbox.defaultValue = config.scale
editbox:SetFocus(false)
editbox:SetAutoFocus(false)
editbox:ClearFocus()

C_Timer.After(1, function()
editbox:SetFocus(false)
editbox:SetAutoFocus(false)
editbox:ClearFocus()
end)

return scaleBar
end

Expand Down Expand Up @@ -3975,7 +3983,7 @@ local tab_container_on_show = function (self)
self.SelectIndex (self.AllButtons[index], nil, index)
end

function DF:CreateTabContainer (parent, title, frame_name, frame_list, options_table)
function DF:CreateTabContainer (parent, title, frame_name, frameList, options_table)

local options_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")
local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")
Expand All @@ -3984,13 +3992,13 @@ function DF:CreateTabContainer (parent, title, frame_name, frame_list, options_t
local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")

options_table = options_table or {}
local frame_width = parent:GetWidth()
local frameWidth = parent:GetWidth()
local frame_height = parent:GetHeight()
local y_offset = options_table.y_offset or 0
local button_width = options_table.button_width or 160
local button_height = options_table.button_height or 20
local button_anchor_x = options_table.button_x or 230
local button_anchor_y = options_table.button_y or -32
local buttonAnchorX = options_table.button_x or 230
local buttonAnchorY = options_table.button_y or -32
local button_text_size = options_table.button_text_size or 10

local mainFrame = CreateFrame ("frame", frame_name, parent.widget or parent, "BackdropTemplate")
Expand All @@ -4015,7 +4023,7 @@ function DF:CreateTabContainer (parent, title, frame_name, frame_list, options_t
mainFrame.CanCloseWithRightClick = true
end

for i, frame in ipairs (frame_list) do
for i, frame in ipairs (frameList) do
local f = CreateFrame ("frame", "$parent" .. frame.name, mainFrame, "BackdropTemplate")
f:SetAllPoints()
f:SetFrameLevel (210)
Expand Down Expand Up @@ -4059,10 +4067,13 @@ function DF:CreateTabContainer (parent, title, frame_name, frame_list, options_t
end

--order buttons
local x = button_anchor_x
local y = button_anchor_y
local space_for_buttons = frame_width - (#frame_list*3) - button_anchor_x
local x = buttonAnchorX
local y = buttonAnchorY
local spaceBetweenButtons = 3

local space_for_buttons = frameWidth - (#frameList * spaceBetweenButtons) - buttonAnchorX
local amount_buttons_per_row = floor (space_for_buttons / button_width)

local last_button = mainFrame.AllButtons[1]

mainFrame.AllButtons[1]:SetPoint ("topleft", mainTitle, "topleft", x, y)
Expand All @@ -4074,7 +4085,7 @@ function DF:CreateTabContainer (parent, title, frame_name, frame_list, options_t
x = x + button_width + 2

if (i % amount_buttons_per_row == 0) then
x = button_anchor_x
x = buttonAnchorX
y = y - button_height - 1
end
end
Expand Down
4 changes: 2 additions & 2 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

local version, build, date, tocversion = GetBuildInfo()

_detalhes.build_counter = 9699
_detalhes.alpha_build_counter = 9699 --if this is higher than the regular counter, use it instead
_detalhes.build_counter = 9700
_detalhes.alpha_build_counter = 9700 --if this is higher than the regular counter, use it instead
_detalhes.bcc_counter = 31
_detalhes.dont_open_news = true
_detalhes.game_version = version
Expand Down

0 comments on commit 3ee7da5

Please sign in to comment.