minor changes

This commit is contained in:
aditya-K2
2023-01-25 02:52:10 +05:30
parent 2f29f51ec4
commit 6c4531b721
2 changed files with 6 additions and 5 deletions

View File

@@ -21,12 +21,13 @@ func NewContextMenu() *ContextMenu {
return c
}
func (c *ContextMenu) Size(mw, mh, ch int) (int, int, int, int) {
func (c *ContextMenu) Size(mw, mh int) (int, int, int, int) {
cslice := c.ContentHandler()
cheight := len(cslice) + 3
cwidth := 30
epx := 4
ch += 3
return mw/2 - (cwidth/2 + epx), (mh/2 - (ch/2 + epx)), cwidth, ch
return mw/2 - (cwidth/2 + epx), (mh/2 - (cheight/2 + epx)), cwidth, cheight
}
func (c *ContextMenu) ContentHandler() []string {

View File

@@ -27,7 +27,7 @@ type CenteredWidget interface {
ContentHandler() []string
SelectionHandler(s string)
Title() string
Size(mw, mh, ch int) (int, int, int, int)
Size(mw, mh int) (int, int, int, int)
}
func (m *Main) addCenteredWidget(t CenteredWidget) {
@@ -42,7 +42,7 @@ func (m *Main) addCenteredWidget(t CenteredWidget) {
}
drawCtx := func() {
m.Root.AddPage(currentTime, t.Primitive(), false, true)
p.SetRect(t.Size(w, h, len(cslice)))
p.SetRect(t.Size(w, h))
}
redraw := func() {
closeCtx()