Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android/iOS: Touch/mouse coordinates are wrong #5256

Open
2 tasks done
pjanx opened this issue Nov 12, 2024 · 2 comments
Open
2 tasks done

Android/iOS: Touch/mouse coordinates are wrong #5256

pjanx opened this issue Nov 12, 2024 · 2 comments
Labels
unverified A bug that has been reported but not verified

Comments

@pjanx
Copy link

pjanx commented Nov 12, 2024

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

In Fyne apps on mobile, you need to tap or click lower than you should.

Happens on real Android, emulated Android, and also in iOS simulator.

How to reproduce

  • Run the example on a mobile platform
  • Tap or click around the Entry
  • You see that it is deselected when you hit its upper part, and selected when you hit the area underneath

Screenshots

No response

Example code

package main

import (
	"net"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/dialog"
	"fyne.io/fyne/v2/driver/mobile"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.New()
	w := a.NewWindow("Bugs")
	w.Resize(fyne.NewSize(640, 480))
	w.SetContent(widget.NewMultiLineEntry())

	connectAddress := widget.NewEntry()
	connectAddress.SetPlaceHolder("host:port")
	connectAddress.Validator = func(text string) error {
		_, _, err := net.SplitHostPort(text)
		return err
	}
	connectAddress.SetText(string([]byte{3, 2, 1, 65, 66, 67, ':', '1'}))
	connectAddress.TypedKey(&fyne.KeyEvent{Name: fyne.KeyPageDown})

	var wConnect *dialog.FormDialog
	wConnect = dialog.NewForm("Connect to relay", "Connect", "Exit",
		[]*widget.FormItem{
			{Text: "Address:", Widget: connectAddress},
		}, func(ok bool) {
			if ok {
			} else if _, ok := a.Driver().(mobile.Driver); ok {
				wConnect.Show()
			} else {
				a.Quit()
			}
		}, w)
	wConnect.Show()
	w.ShowAndRun()
}

Fyne version

2.5.2

Go compiler version

1.23.2

Operating system and version

Android

Additional Information

No response

@pjanx pjanx added the unverified A bug that has been reported but not verified label Nov 12, 2024
@pjanx
Copy link
Author

pjanx commented Nov 13, 2024

I didn't know this was intentional: a44331a

Any offset is wrong! Styluses exist. At most if you can decouple the mouse or stylus from touch events.

@andydotxyz
Copy link
Member

I agree with your summary. If the input device is a stylus we should not offset it. Feel free to adapt this issue or open a new one for that purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unverified A bug that has been reported but not verified
Projects
None yet
Development

No branches or pull requests

2 participants