Skip to content

Commit

Permalink
Merge pull request #1792 from andydotxyz/fix/1771
Browse files Browse the repository at this point in the history
Fix location of mobile popups by fixing the absolute position lookup
  • Loading branch information
andydotxyz committed Jan 14, 2021
2 parents 73e3659 + 69a109c commit ce06fb9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion internal/driver/gomobile/driver.go
Expand Up @@ -21,6 +21,7 @@ import (
"fyne.io/fyne/internal/painter"
pgl "fyne.io/fyne/internal/painter/gl"
"fyne.io/fyne/theme"
"fyne.io/fyne/widget"
)

const tapSecondaryDelay = 300 * time.Millisecond
Expand Down Expand Up @@ -83,7 +84,16 @@ func (d *mobileDriver) AbsolutePositionForObject(co fyne.CanvasObject) fyne.Posi
}

mc := c.(*mobileCanvas)
return driver.AbsolutePositionForObject(co, mc.objectTrees())
pos := driver.AbsolutePositionForObject(co, mc.objectTrees())
inset, _ := c.InteractiveArea()

if mc.windowHead != nil {
if len(mc.windowHead.(*widget.Box).Children) > 1 {
topHeight := mc.windowHead.MinSize().Height
pos = pos.Subtract(fyne.NewSize(0, topHeight))
}
}
return pos.Subtract(inset)
}

func (d *mobileDriver) Quit() {
Expand Down

0 comments on commit ce06fb9

Please sign in to comment.