fixed issue with ranges not showing

This commit is contained in:
davidmolgard
2025-03-24 12:26:53 -06:00
parent 883464a074
commit bc324e939a
3 changed files with 6 additions and 29 deletions

View File

@@ -148,7 +148,7 @@ function G.FUNCS.dv_pre_score_UI_set(e)
local new_preview_text = ""
local should_juice = false
if DV.PRE.data then
if G.SETTINGS.DV.show_min_max and (DV.PRE.data.score.min ~= DV.PRE.data.score.max) then
if true and (DV.PRE.data.score.min ~= DV.PRE.data.score.max) then
-- Format as 'X - Y' :
if e.config.id == "dv_pre_l" then
new_preview_text = DV.PRE.format_number(DV.PRE.data.score.min) .. " - "
@@ -160,7 +160,7 @@ function G.FUNCS.dv_pre_score_UI_set(e)
else
-- Format as single number:
if e.config.id == "dv_pre_l" then
if G.SETTINGS.DV.show_min_max then
if true then
-- Spaces around number necessary to distinguish Min/Max text from Exact text,
-- which is itself necessary to force a HUD update when switching between Min/Max and Exact.
new_preview_text = " " .. DV.PRE.format_number(DV.PRE.data.score.min) .. " "
@@ -176,7 +176,7 @@ function G.FUNCS.dv_pre_score_UI_set(e)
else
-- Spaces around number necessary to distinguish Min/Max text from Exact text, same as above ^
if e.config.id == "dv_pre_l" then
if G.SETTINGS.DV.show_min_max then new_preview_text = " ?????? "
if true then new_preview_text = " ?????? "
else new_preview_text = "??????"
end
else
@@ -205,7 +205,7 @@ function G.FUNCS.dv_pre_dollars_UI_set(e)
local new_preview_text = ""
local new_colour = nil
if DV.PRE.data then
if G.SETTINGS.DV.show_min_max and (DV.PRE.data.dollars.min ~= DV.PRE.data.dollars.max) then
if true and (DV.PRE.data.dollars.min ~= DV.PRE.data.dollars.max) then
if e.config.id == "dv_pre_dollars_top" then
new_preview_text = " " .. DV.PRE.get_sign_str(DV.PRE.data.dollars.max) .. DV.PRE.data.dollars.max
new_colour = DV.PRE.get_dollar_colour(DV.PRE.data.dollars.max)

View File

@@ -20,7 +20,7 @@ end
function DV.PRE.get_score_node()
local text_scale = nil
if G.SETTINGS.DV.show_min_max then text_scale = 0.5
if true then text_scale = 0.5
else text_scale = 0.75 end
return {n = G.UIT.C, config = {id = "dv_pre_score", align = "cm"}, nodes={
@@ -88,25 +88,6 @@ function DV.get_preview_settings_page()
G.HUD:recalculate()
end
local function minmax_toggle_callback(_)
if not G.HUD or not DV.PRE.enabled() then return end
DV.PRE.data = DV.PRE.simulate()
if G.SETTINGS.DV.preview_score then
if not G.SETTINGS.DV.show_min_max then
-- Min-Max was just disabled, so increase scale:
G.HUD:get_UIE_by_ID("dv_pre_l").config.object.scale = 0.75
G.HUD:get_UIE_by_ID("dv_pre_r").config.object.scale = 0.75
else
-- Min-Max was just enabled, so decrease scale:
G.HUD:get_UIE_by_ID("dv_pre_l").config.object.scale = 0.5
G.HUD:get_UIE_by_ID("dv_pre_r").config.object.scale = 0.5
end
G.HUD:recalculate()
end
end
return
{n=G.UIT.ROOT, config={align = "cm", padding = 0.05, colour = G.C.CLEAR}, nodes={
create_toggle({id = "score_toggle",
@@ -119,10 +100,6 @@ function DV.get_preview_settings_page()
ref_table = G.SETTINGS.DV,
ref_value = "preview_dollars",
callback = preview_dollars_toggle_callback}),
create_toggle({label = "Show Min/Max Preview Instead of Exact",
ref_table = G.SETTINGS.DV,
ref_value = "show_min_max",
callback = minmax_toggle_callback}),
create_toggle({label = "Hide Preview if Any Card is Face-Down",
ref_table = G.SETTINGS.DV,
ref_value = "hide_face_down",

View File

@@ -15,7 +15,7 @@ end
function DV.PRE.format_number(num)
if not num or type(num) ~= 'number' then return num or '' end
-- Start using e-notation earlier to reduce number length, if showing min and max for preview:
if G.SETTINGS.DV.show_min_max and num >= 1e7 then
if true and num >= 1e7 then
local x = string.format("%.4g",num)
local fac = math.floor(math.log(tonumber(x), 10))
return string.format("%.2f",x/(10^fac))..'e'..fac