From 61a7d8849045079ad7992994fb5808bc826feff0 Mon Sep 17 00:00:00 2001 From: reluctant-git-user <147989986+reluctant-git-user@users.noreply.github.com> Date: Sun, 15 Oct 2023 17:36:15 +0300 Subject: [PATCH] Update microui.odin; slider 'step' parameter was not working --- vendor/microui/microui.odin | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vendor/microui/microui.odin b/vendor/microui/microui.odin index 7967f7f4b..1ddad2121 100644 --- a/vendor/microui/microui.odin +++ b/vendor/microui/microui.odin @@ -28,6 +28,7 @@ import "core:fmt" import "core:sort" import "core:strings" import "core:strconv" +import "core:math" COMMAND_LIST_SIZE :: #config(MICROUI_COMMAND_LIST_SIZE, 256 * 1024) ROOT_LIST_SIZE :: #config(MICROUI_ROOT_LIST_SIZE, 32) @@ -1063,7 +1064,7 @@ slider :: proc(ctx: ^Context, value: ^Real, low, high: Real, step: Real = 0.0, f if ctx.focus_id == id && ctx.mouse_down_bits == {.LEFT} { v = low + Real(ctx.mouse_pos.x - base.x) * (high - low) / Real(base.w) if step != 0.0 { - v = ((v + step/2) / step) * step + v = math.floor((v + step/2) / step) * step } } /* clamp and store value, update res */ @@ -1442,4 +1443,4 @@ end_panel :: proc(ctx: ^Context) { @private mouse_released :: #force_inline proc(ctx: ^Context) -> bool { return ctx.mouse_released_bits != nil } @private mouse_pressed :: #force_inline proc(ctx: ^Context) -> bool { return ctx.mouse_pressed_bits != nil } -@private mouse_down :: #force_inline proc(ctx: ^Context) -> bool { return ctx.mouse_down_bits != nil } \ No newline at end of file +@private mouse_down :: #force_inline proc(ctx: ^Context) -> bool { return ctx.mouse_down_bits != nil }