diff --git a/io/input/router.go b/io/input/router.go index 3080f458..b72d97cf 100644 --- a/io/input/router.go +++ b/io/input/router.go @@ -628,11 +628,11 @@ func (q *Router) RevealFocus(viewport image.Rectangle) { viewport = q.pointer.queue.ClipFor(area, viewport) topleft := bounds.Min.Sub(viewport.Min) - topleft = max(topleft, bounds.Max.Sub(viewport.Max)) - topleft = min(image.Pt(0, 0), topleft) + topleft = maxPoint(topleft, bounds.Max.Sub(viewport.Max)) + topleft = minPoint(image.Pt(0, 0), topleft) bottomright := bounds.Max.Sub(viewport.Max) - bottomright = min(bottomright, bounds.Min.Sub(viewport.Min)) - bottomright = max(image.Pt(0, 0), bottomright) + bottomright = minPoint(bottomright, bounds.Min.Sub(viewport.Min)) + bottomright = maxPoint(image.Pt(0, 0), bottomright) s := topleft if s.X == 0 { s.X = bottomright.X @@ -659,7 +659,7 @@ func (q *Router) ScrollFocus(dist image.Point) { })) } -func max(p1, p2 image.Point) image.Point { +func maxPoint(p1, p2 image.Point) image.Point { m := p1 if p2.X > m.X { m.X = p2.X @@ -670,7 +670,7 @@ func max(p1, p2 image.Point) image.Point { return m } -func min(p1, p2 image.Point) image.Point { +func minPoint(p1, p2 image.Point) image.Point { m := p1 if p2.X < m.X { m.X = p2.X diff --git a/text/gotext.go b/text/gotext.go index d7b35aee..f37314de 100644 --- a/text/gotext.go +++ b/text/gotext.go @@ -56,13 +56,6 @@ func (l *document) reset() { l.unreadRuneCount = 0 } -func max(a, b int) int { - if a > b { - return a - } - return b -} - // A line contains the measurements of a line of text. type line struct { // runs contains sequences of shaped glyphs with common attributes. The order diff --git a/widget/editor.go b/widget/editor.go index 46470a70..bf477121 100644 --- a/widget/editor.go +++ b/widget/editor.go @@ -1093,20 +1093,6 @@ func (e *Editor) Regions(start, end int, regions []Region) []Region { return e.text.Regions(start, end, regions) } -func max(a, b int) int { - if a > b { - return a - } - return b -} - -func min(a, b int) int { - if a < b { - return a - } - return b -} - func abs(n int) int { if n < 0 { return -n diff --git a/widget/material/slider.go b/widget/material/slider.go index 97253259..740dff3f 100644 --- a/widget/material/slider.go +++ b/widget/material/slider.go @@ -94,17 +94,3 @@ func (s SliderStyle) Layout(gtx layout.Context) layout.Dimensions { return layout.Dimensions{Size: size} } - -func max(a, b int) int { - if a > b { - return a - } - return b -} - -func min(a, b int) int { - if a < b { - return a - } - return b -}