mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +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
+2
-1
@@ -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 */
|
||||||
|
|||||||
Reference in New Issue
Block a user