Skip to content

Commit

Permalink
Fixed help HUD issues
Browse files Browse the repository at this point in the history
  • Loading branch information
esimov committed Nov 4, 2023
1 parent c3ca002 commit 5e41c91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions help.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (h *Hud) ShowHelpDialog(gtx layout.Context, th *material.Theme, isActive bo
centerY := windowHeight / 2

switch width := gtx.Dp(unit.Dp(windowWidth)); {
case width <= windowSizeX:
case width <= gtx.Dp(windowSizeX):
panelWidth = gtx.Dp(unit.Dp(windowWidth / 2))
default:
panelWidth = gtx.Dp(unit.Dp(windowWidth / 3))
Expand All @@ -61,7 +61,7 @@ func (h *Hud) ShowHelpDialog(gtx layout.Context, th *material.Theme, isActive bo

// Limit the applicable constraints to the panel size from this point onward.
gtx.Constraints.Min.X = panelWidth
gtx.Constraints.Max.X = panelWidth
gtx.Constraints.Max.X = gtx.Constraints.Min.X

// This offset will apply to the rest of the content laid out in this function.
defer op.Offset(image.Point{X: dx, Y: dy}).Push(gtx.Ops).Pop()
Expand Down Expand Up @@ -99,9 +99,9 @@ func (h *Hud) ShowHelpDialog(gtx layout.Context, th *material.Theme, isActive bo
layout.Rigid(h1.Layout),
)
})
gtx.Constraints.Min.X = panelWidth - 220
gtx.Constraints.Min.X = panelWidth - gtx.Dp(220)
defer op.Offset(image.Point{X: 0, Y: gtx.Dp(50)}).Push(gtx.Ops).Pop()

defer op.Offset(image.Point{X: 0, Y: 50}).Push(gtx.Ops).Pop()
h.list.Layout(gtx, len(h.commands),
func(gtx C, index int) D {
builder := strings.Builder{}
Expand Down
4 changes: 2 additions & 2 deletions hud.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ func (h *Hud) DrawCtrlBtn(gtx layout.Context, th *material.Theme, isActive bool)

var path clip.Path

offset := float32(unit.Dp(10))
btnSize := float32(h.btnSize)
offset := float32(gtx.Dp(unit.Dp(10)))
btnSize := float32(unit.Dp(h.btnSize))
spacing := btnSize / 4
startX := btnSize/2 - spacing

Expand Down

0 comments on commit 5e41c91

Please sign in to comment.