all: avoid collides with builtin min/max functions

Signed-off-by: Walter Werner SCHNEIDER <contact@schnwalter.eu>
This commit is contained in:
Walter Werner SCHNEIDER
2025-07-14 09:44:44 +03:00
committed by Elias Naur
parent 4e5a344cc2
commit ba82ae46d0
4 changed files with 6 additions and 41 deletions
+6 -6
View File
@@ -628,11 +628,11 @@ func (q *Router) RevealFocus(viewport image.Rectangle) {
viewport = q.pointer.queue.ClipFor(area, viewport) viewport = q.pointer.queue.ClipFor(area, viewport)
topleft := bounds.Min.Sub(viewport.Min) topleft := bounds.Min.Sub(viewport.Min)
topleft = max(topleft, bounds.Max.Sub(viewport.Max)) topleft = maxPoint(topleft, bounds.Max.Sub(viewport.Max))
topleft = min(image.Pt(0, 0), topleft) topleft = minPoint(image.Pt(0, 0), topleft)
bottomright := bounds.Max.Sub(viewport.Max) bottomright := bounds.Max.Sub(viewport.Max)
bottomright = min(bottomright, bounds.Min.Sub(viewport.Min)) bottomright = minPoint(bottomright, bounds.Min.Sub(viewport.Min))
bottomright = max(image.Pt(0, 0), bottomright) bottomright = maxPoint(image.Pt(0, 0), bottomright)
s := topleft s := topleft
if s.X == 0 { if s.X == 0 {
s.X = bottomright.X 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 m := p1
if p2.X > m.X { if p2.X > m.X {
m.X = p2.X m.X = p2.X
@@ -670,7 +670,7 @@ func max(p1, p2 image.Point) image.Point {
return m return m
} }
func min(p1, p2 image.Point) image.Point { func minPoint(p1, p2 image.Point) image.Point {
m := p1 m := p1
if p2.X < m.X { if p2.X < m.X {
m.X = p2.X m.X = p2.X
-7
View File
@@ -56,13 +56,6 @@ func (l *document) reset() {
l.unreadRuneCount = 0 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. // A line contains the measurements of a line of text.
type line struct { type line struct {
// runs contains sequences of shaped glyphs with common attributes. The order // runs contains sequences of shaped glyphs with common attributes. The order
-14
View File
@@ -1093,20 +1093,6 @@ func (e *Editor) Regions(start, end int, regions []Region) []Region {
return e.text.Regions(start, end, regions) 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 { func abs(n int) int {
if n < 0 { if n < 0 {
return -n return -n
-14
View File
@@ -94,17 +94,3 @@ func (s SliderStyle) Layout(gtx layout.Context) layout.Dimensions {
return layout.Dimensions{Size: size} 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
}