Merge branch 'dev'
This commit is contained in:
@@ -21,11 +21,12 @@ var (
|
||||
)
|
||||
|
||||
type FlatItem struct {
|
||||
Label StringItem
|
||||
ID string
|
||||
IsCategory bool
|
||||
Depth int
|
||||
Expanded bool
|
||||
Label StringItem
|
||||
ID string
|
||||
IsCategory bool
|
||||
IsSubCategory bool
|
||||
Depth int
|
||||
Expanded bool
|
||||
}
|
||||
|
||||
type ProclamationOptions struct {
|
||||
@@ -79,7 +80,7 @@ func (p *ProclamationOptions) Init(ctx *PageCtx) error {
|
||||
p.title, _ = NewStringItem("Proclamation Browser", p.font, colors.White)
|
||||
p.title.Scale(float32(64) / float32(ctx.CfgPtr.StandardFontSize))
|
||||
|
||||
p.prompt, _ = NewStringItem("Arrows: Nav | Enter: Exp/Col | Space: Toggle | A: Accept | Back: Cancel", p.font, colors.White)
|
||||
p.prompt, _ = NewStringItem("Arrows: Nav Space: Select/Expand Enter: Save Changes Back: Cancel", p.font, colors.White)
|
||||
p.prompt.Scale(itemScale * 0.8)
|
||||
|
||||
// Calculation for visible area
|
||||
@@ -226,14 +227,14 @@ func (p *ProclamationOptions) HandleEvent(event *sdl.Event) error {
|
||||
p.scrollOffset = bottomIdx
|
||||
p.highlightIndex = bottomIdx
|
||||
case sdl.K_RETURN:
|
||||
p.toggleExpansion(p.highlightIndex)
|
||||
p.acceptChanges()
|
||||
case sdl.K_SPACE:
|
||||
item := p.allItems[p.highlightIndex]
|
||||
if !item.IsCategory {
|
||||
p.activeMap[item.ID] = !p.activeMap[item.ID]
|
||||
} else {
|
||||
p.toggleExpansion(p.highlightIndex)
|
||||
}
|
||||
case sdl.K_a:
|
||||
p.acceptChanges()
|
||||
case sdl.K_BACKSPACE, sdl.K_ESCAPE:
|
||||
p.Context.NavigateTo(SETTINGS)
|
||||
}
|
||||
@@ -256,7 +257,7 @@ func (p *ProclamationOptions) acceptChanges() {
|
||||
}
|
||||
return nil
|
||||
})
|
||||
p.Context.NavigateTo(SETTINGS)
|
||||
p.Context.NavigateTo(SCROLLER)
|
||||
}
|
||||
|
||||
func (p *ProclamationOptions) Render() error {
|
||||
@@ -278,9 +279,9 @@ func (p *ProclamationOptions) Render() error {
|
||||
if i == p.highlightIndex {
|
||||
item.Label.Color = colors.Black
|
||||
} else if item.IsCategory {
|
||||
item.Label.Color = colors.Cyan
|
||||
item.Label.Color = colors.DodgerBlue
|
||||
} else if p.activeMap[item.ID] {
|
||||
item.Label.Color = colors.Green
|
||||
item.Label.Color = colors.Orange
|
||||
} else {
|
||||
item.Label.Color = colors.White
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user