mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Merge pull request #2871 from reluctant-git-user/master
Update microui.odin; slider 'step' parameter was not working
This commit is contained in:
Vendored
+3
-2
@@ -28,6 +28,7 @@ import "core:fmt"
|
|||||||
import "core:sort"
|
import "core:sort"
|
||||||
import "core:strings"
|
import "core:strings"
|
||||||
import "core:strconv"
|
import "core:strconv"
|
||||||
|
import "core:math"
|
||||||
|
|
||||||
COMMAND_LIST_SIZE :: #config(MICROUI_COMMAND_LIST_SIZE, 256 * 1024)
|
COMMAND_LIST_SIZE :: #config(MICROUI_COMMAND_LIST_SIZE, 256 * 1024)
|
||||||
ROOT_LIST_SIZE :: #config(MICROUI_ROOT_LIST_SIZE, 32)
|
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} {
|
if ctx.focus_id == id && ctx.mouse_down_bits == {.LEFT} {
|
||||||
v = low + Real(ctx.mouse_pos.x - base.x) * (high - low) / Real(base.w)
|
v = low + Real(ctx.mouse_pos.x - base.x) * (high - low) / Real(base.w)
|
||||||
if step != 0.0 {
|
if step != 0.0 {
|
||||||
v = ((v + step/2) / step) * step
|
v = math.floor((v + step/2) / step) * step
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* clamp and store value, update res */
|
/* 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_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_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 }
|
@private mouse_down :: #force_inline proc(ctx: ^Context) -> bool { return ctx.mouse_down_bits != nil }
|
||||||
|
|||||||
Reference in New Issue
Block a user