only update slider when cursor moves
This commit is contained in:
parent
fa04e56065
commit
169a74f637
@ -86,10 +86,10 @@ V_WidgetTheme V_GetWidgetTheme(void)
|
|||||||
theme.font_size = TweakFloat("Font size", 14, 6, 50, .precision = 0);
|
theme.font_size = TweakFloat("Font size", 14, 6, 50, .precision = 0);
|
||||||
theme.h1 = 2.00;
|
theme.h1 = 2.00;
|
||||||
theme.h2 = 1.50;
|
theme.h2 = 1.50;
|
||||||
theme.h3 = 1.17;
|
theme.h3 = 1.25;
|
||||||
theme.h4 = 1.00;
|
theme.h4 = 1.0;
|
||||||
theme.h5 = 0.83;
|
theme.h5 = 0.875;
|
||||||
theme.h6 = 0.67;
|
theme.h6 = 0.75;
|
||||||
|
|
||||||
// theme.rounding = 0;
|
// theme.rounding = 0;
|
||||||
// theme.rounding = 1;
|
// theme.rounding = 1;
|
||||||
@ -1612,7 +1612,7 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
|
|
||||||
f64 tweak_float = FloatFromString(new_tweak_str);
|
f64 tweak_float = FloatFromString(new_tweak_str);
|
||||||
{
|
{
|
||||||
if (slider_reps.draw.m1.held)
|
if (slider_reps.draw.m1.held && (frame->ui_cursor.x != last_frame->ui_cursor.x))
|
||||||
{
|
{
|
||||||
f64 initial_marker_width = DimsFromRng2(marker_reps.drag.screen_rect).x;
|
f64 initial_marker_width = DimsFromRng2(marker_reps.drag.screen_rect).x;
|
||||||
f64 initial_slider_pos = slider_reps.drag.screen_rect.p0.x;
|
f64 initial_slider_pos = slider_reps.drag.screen_rect.p0.x;
|
||||||
@ -1622,13 +1622,10 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
|
|
||||||
f64 virtual_slider_start = initial_cursor - (initial_slider_width * initial_ratio);
|
f64 virtual_slider_start = initial_cursor - (initial_slider_width * initial_ratio);
|
||||||
f64 virtual_slider_end = virtual_slider_start + initial_slider_width;
|
f64 virtual_slider_end = virtual_slider_start + initial_slider_width;
|
||||||
|
f64 virtual_cursor_ratio = (frame->ui_cursor.x - virtual_slider_start) / (virtual_slider_end - virtual_slider_start);
|
||||||
f64 virtual_cursor = ClampF32(frame->ui_cursor.x, virtual_slider_start, virtual_slider_end);
|
|
||||||
f64 virtual_cursor_ratio = (virtual_cursor - virtual_slider_start) / (virtual_slider_end - virtual_slider_start);
|
|
||||||
|
|
||||||
tweak_float = LerpF64(range_min, range_max, virtual_cursor_ratio);
|
tweak_float = LerpF64(range_min, range_max, virtual_cursor_ratio);
|
||||||
tweak_float = ClampF64(tweak_float, range_min, range_max);
|
tweak_float = ClampF64(tweak_float, range_min, range_max);
|
||||||
|
|
||||||
new_tweak_str = StringFromFloat(frame->arena, tweak_float, tweak_desc.precision);
|
new_tweak_str = StringFromFloat(frame->arena, tweak_float, tweak_desc.precision);
|
||||||
}
|
}
|
||||||
if (slider_reps.draw.is_hot)
|
if (slider_reps.draw.is_hot)
|
||||||
|
|||||||
@ -815,14 +815,14 @@ UI_Frame *UI_BeginFrame(UI_FrameFlag frame_flags, Vec4 swapchain_color)
|
|||||||
f32 hot_blend_rate = target_hot == 1 ? 1 : (15 * frame->dt);
|
f32 hot_blend_rate = target_hot == 1 ? 1 : (15 * frame->dt);
|
||||||
f32 active_blend_rate = target_active == 1 ? 1 : (15 * frame->dt);
|
f32 active_blend_rate = target_active == 1 ? 1 : (15 * frame->dt);
|
||||||
f32 hovered_blend_rate = target_hovered == 1 ? 1 : (15 * frame->dt);
|
f32 hovered_blend_rate = target_hovered == 1 ? 1 : (15 * frame->dt);
|
||||||
f64 misc_blend_rate = (30 * frame->dt);
|
// f64 misc_blend_rate = (30 * frame->dt);
|
||||||
|
f64 misc_blend_rate = 1;
|
||||||
|
|
||||||
report->exists = LerpF32(report->exists, target_exists, exists_blend_rate);
|
report->exists = LerpF32(report->exists, target_exists, exists_blend_rate);
|
||||||
report->hot = LerpF32(report->hot, target_hot, hot_blend_rate);
|
report->hot = LerpF32(report->hot, target_hot, hot_blend_rate);
|
||||||
report->active = LerpF32(report->active, target_active, active_blend_rate);
|
report->active = LerpF32(report->active, target_active, active_blend_rate);
|
||||||
report->hovered = LerpF32(report->hovered, target_hovered, hovered_blend_rate);
|
report->hovered = LerpF32(report->hovered, target_hovered, hovered_blend_rate);
|
||||||
// report->misc = LerpF32(report->misc, target_misc, misc_blend_rate);
|
report->misc = LerpF32(report->misc, target_misc, misc_blend_rate);
|
||||||
report->misc = target_misc;
|
|
||||||
|
|
||||||
report->screen_rect = box->screen_rect;
|
report->screen_rect = box->screen_rect;
|
||||||
report->screen_anchor = box->screen_anchor;
|
report->screen_anchor = box->screen_anchor;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user