mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
all: avoid collides with builtin min/max functions
Signed-off-by: Walter Werner SCHNEIDER <contact@schnwalter.eu>
This commit is contained in:
committed by
Elias Naur
parent
4e5a344cc2
commit
ba82ae46d0
+6
-6
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user