shithub: microui

Download patch

ref: 67f793f1975245b9db8ac0e0797d6339f2ce96db
parent: b8b6a0e523f7f780a66ad38327d34b8185533c90
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sun Jan 12 14:10:42 EST 2020

slider: fix value going wrong when negative is allowed

--- a/microui.c
+++ b/microui.c
@@ -1020,7 +1020,7 @@
 	}
 
 	if (step)
-		v = ((long)((v + step/2) / step)) * step;
+		v = ((long)((v + (v > 0 ? step/2 : (-step/2))) / step)) * step;
 	/* clamp and store value, update res */
 	*value = v = CLAMP(v, low, high);
 	if (last != v)