Skip to content

Commit

Permalink
fixed #47
Browse files Browse the repository at this point in the history
  • Loading branch information
elect86 committed Jul 27, 2018
1 parent 02f50b8 commit 0b12a2e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ object StyleEditor {
if (style.curveTessellationTol < 0f) style.curveTessellationTol = 0.1f
/* Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets).
But application code could have a toggle to switch between zero and non-zero. */
dragFloat("Global Alpha", style::alpha, 0.005f, 0.2f, 1f, "%.2f") // TODO fix me dragging
dragFloat("Global Alpha", style::alpha, 0.005f, 0.2f, 1f, "%.2f")
popItemWidth()
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/imgui/imgui/internal.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3512,7 +3512,7 @@ interface imgui_internal {
if (format[fmtStart] != '%' || format[fmtStart + 1] == '%') // Don't apply if the value is not visible in the format string
return value
val vStr = format.substring(parseFormatFindStart(format)).format(style.locale, value)
return vStr.trimStart().f
return vStr.trimStart().split(Regex("\\s+"))[0].f
}

fun roundScalarWithFormat(format: String, value: Double): Double {
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/imgui/imgui/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ interface imgui_main {
val vNewNormCurved = vOldNormCurved + g.dragCurrentAccum / (vMax - vMin)
vCur = vMin + glm.pow(saturate(vNewNormCurved.f), power).L * (vMax - vMin)
vOldRefForAccumRemainder = vOldNormCurved
} else vCur += g.dragCurrentAccum.i
} else vCur += g.dragCurrentAccum.L

// Round to user desired precision based on format string
vCur = roundScalarWithFormat(format, vCur)
Expand Down Expand Up @@ -829,7 +829,7 @@ interface imgui_main {
val vNewNormCurved = vOldNormCurved + g.dragCurrentAccum / (vMax - vMin)
vCur = vMin + glm.pow(saturate(vNewNormCurved.f), power) * (vMax - vMin)
vOldRefForAccumRemainder = vOldNormCurved
} else vCur += g.dragCurrentAccum.i
} else vCur += g.dragCurrentAccum
// Round to user desired precision based on format string
vCur = roundScalarWithFormat(format, vCur)

Expand Down Expand Up @@ -916,7 +916,7 @@ interface imgui_main {
val vNewNormCurved = vOldNormCurved + g.dragCurrentAccum / (vMax - vMin)
vCur = vMin + glm.pow(saturate(vNewNormCurved.f), power).d * (vMax - vMin)
vOldRefForAccumRemainder = vOldNormCurved
} else vCur += g.dragCurrentAccum.i
} else vCur += g.dragCurrentAccum.d

// Round to user desired precision based on format string
vCur = roundScalarWithFormat(format, vCur)
Expand Down

0 comments on commit 0b12a2e

Please sign in to comment.