Renamed Gauge.Align
to Gauge.LabelAlign
.
This commit is contained in:
parent
137d2a7eb2
commit
83a3a236f4
@ -54,7 +54,7 @@ func main() {
|
|||||||
g3.Y = 11
|
g3.Y = 11
|
||||||
g3.Border.Label = "Gauge with custom label"
|
g3.Border.Label = "Gauge with custom label"
|
||||||
g3.Label = "{{percent}}% (100MBs free)"
|
g3.Label = "{{percent}}% (100MBs free)"
|
||||||
g3.Align = termui.AlignRight
|
g3.LabelAlign = termui.AlignRight
|
||||||
|
|
||||||
termui.Render(g0, g1, g2, g3)
|
termui.Render(g0, g1, g2, g3)
|
||||||
|
|
||||||
|
6
gauge.go
6
gauge.go
@ -37,7 +37,7 @@ type Gauge struct {
|
|||||||
BarColor Attribute
|
BarColor Attribute
|
||||||
PercentColor Attribute
|
PercentColor Attribute
|
||||||
Label string
|
Label string
|
||||||
Align Align
|
LabelAlign Align
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGauge return a new gauge with current theme.
|
// NewGauge return a new gauge with current theme.
|
||||||
@ -47,7 +47,7 @@ func NewGauge() *Gauge {
|
|||||||
PercentColor: theme.GaugePercent,
|
PercentColor: theme.GaugePercent,
|
||||||
BarColor: theme.GaugeBar,
|
BarColor: theme.GaugeBar,
|
||||||
Label: "{{percent}}%",
|
Label: "{{percent}}%",
|
||||||
Align: AlignCenter,
|
LabelAlign: AlignCenter,
|
||||||
}
|
}
|
||||||
|
|
||||||
g.Width = 12
|
g.Width = 12
|
||||||
@ -80,7 +80,7 @@ func (g *Gauge) Buffer() []Point {
|
|||||||
pry := g.innerY + g.innerHeight/2
|
pry := g.innerY + g.innerHeight/2
|
||||||
rs := str2runes(s)
|
rs := str2runes(s)
|
||||||
var pos int
|
var pos int
|
||||||
switch g.Align {
|
switch g.LabelAlign {
|
||||||
case AlignLeft:
|
case AlignLeft:
|
||||||
pos = 0
|
pos = 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user