danaugrs 7 лет назад
Родитель
Сommit
76f57c5ff1
3 измененных файлов с 9 добавлено и 4 удалено
  1. 1 1
      gui/builder.go
  2. 3 3
      gui/root.go
  3. 5 0
      gui/util.go

+ 1 - 1
gui/builder.go

@@ -39,7 +39,7 @@ type BuilderFunc func(*Builder, map[string]interface{}) (IPanel, error)
 // AttribCheckFunc is the type for all attribute check functions
 type AttribCheckFunc func(b *Builder, am map[string]interface{}, fname string) error
 
-// IgnoreSuffix specified the suffix of ignored keys
+// IgnoreSuffix specifies the suffix of ignored keys
 const IgnoreSuffix = "_"
 
 // Panel and layout types

+ 3 - 3
gui/root.go

@@ -234,8 +234,8 @@ func (r *Root) onCursor(evname string, ev interface{}) {
 	r.sendPanels(cev.Xpos, cev.Ypos, evname, ev)
 }
 
-// sendPanel sends mouse or cursor event to focused panel or panels
-// which contains the specified screen position
+// sendPanel sends a mouse or cursor event to focused panel or panels
+// which contain the specified screen position
 func (r *Root) sendPanels(x, y float32, evname string, ev interface{}) {
 
 	// If there is panel with MouseFocus send only to this panel
@@ -255,7 +255,7 @@ func (r *Root) sendPanels(x, y float32, evname string, ev interface{}) {
 	r.targets = r.targets[0:0]
 
 	// checkPanel checks recursively if the specified panel and
-	// any of its child contains the mouse position
+	// any of its children contain the mouse position
 	var checkPanel func(ipan IPanel)
 	checkPanel = func(ipan IPanel) {
 		pan := ipan.GetPanel()

+ 5 - 0
gui/util.go

@@ -4,6 +4,8 @@
 
 package gui
 
+// RectBounds specifies the size of the boundaries of a rectangle.
+// It can represent the thickness of the borders, the margins, or the padding of a rectangle.
 type RectBounds struct {
 	Top    float32
 	Right  float32
@@ -11,6 +13,7 @@ type RectBounds struct {
 	Left   float32
 }
 
+// Set sets the values of the RectBounds.
 func (bs *RectBounds) Set(top, right, bottom, left float32) {
 
 	if top >= 0 {
@@ -27,6 +30,7 @@ func (bs *RectBounds) Set(top, right, bottom, left float32) {
 	}
 }
 
+// Rect represents a rectangle.
 type Rect struct {
 	X      float32
 	Y      float32
@@ -34,6 +38,7 @@ type Rect struct {
 	Height float32
 }
 
+// Contains determines whether a 2D point is inside the Rect.
 func (r *Rect) Contains(x, y float32) bool {
 
 	if x < r.X || x > r.X+r.Width {