ui: get rid of Inf

It's not worth the special cases. Use a large value where needed
(layout.List, text.Editor...) instead.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-07-29 12:12:51 +02:00
parent 1b684ffab6
commit 5f2adf9b2f
10 changed files with 33 additions and 81 deletions
-3
View File
@@ -153,9 +153,6 @@ func (c *Config) Px(v ui.Value) int {
default:
panic("unknown unit")
}
if math.IsInf(float64(r), +1) {
return ui.Inf
}
return int(math.Round(float64(r)))
}
+2 -16
View File
@@ -606,25 +606,11 @@ func boundRectF(r f32.Rectangle) image.Rectangle {
}
func ceil(v float32) int {
switch {
case math.IsInf(float64(v), +1):
return ui.Inf
case math.IsInf(float64(v), -1):
return -ui.Inf
default:
return int(math.Ceil(float64(v)))
}
return int(math.Ceil(float64(v)))
}
func floor(v float32) int {
switch {
case math.IsInf(float64(v), +1):
return ui.Inf
case math.IsInf(float64(v), -1):
return -ui.Inf
default:
return int(math.Floor(float64(v)))
}
return int(math.Floor(float64(v)))
}
func (d *drawOps) reset(cache *resourceCache, viewport image.Point) {