magnifier magnifies the wrong area
Package Version stable or main branch
To Reproduce On ios, long press on text to display magnifier.
Actual behavior See video below. simulator (iPhone 15 iOS 17.0) running super editor example. magnified area is off. It looks like it magnifies the content below the cursor.
supereditor ios magnifier.webm
Expected behavior
Same with Android simulator (Pixel 7 Pro API 32):
Platform iOS and Android
Flutter version 3.19.1
Additional context I suggest the super_editor default magnifier to use or take inspiration from Flutter CupertinoTextMagnifier/TextMagnifier
@BazinC Are you using some specific settings to trigger this issue on Android? I was able to reproduce it on iOS only.
@angelosilvestre For Android I'm just running the demo app, from stable branch, on an Android Simulator (Pixel 7 Pro API 32). I don't have a physical Android device with me right now. I can try later when I have one.
@angelosilvestre @BazinC - It looks like we're seeing unpredictable API level problems for Android:
- Pixel 7 Pro emulator, API 32: The magnification region is too low
- Pixel 7 Pro emulator, API 33: The magnification region is correct
- Pixel 7 Pro emulator, API 34: The magnification region is too low
EDIT:
I take that back. Somehow I got the devices mixed up. It looks like all Pixel 7 Pro emulators have the problem. The Pixel 6 emulator doesn't. I noticed that there's a difference in pixel density between Pixel 7 Pro and Pixel 6.
@angelosilvestre please see if you can work a MediaQuery pixel density into the number. For example, right now the vertical offset is -58 and when that number works as desired, the pixel density is 2.625. This implies that the density independent offset is -58 / 2.625 ~= 22. Therefore, if we change to Offset(0, -22 * MediaQuery.of(context).devicePixelRatio) I think it should be OK everywhere. We'll need a similar change for iOS, but with a different value that's chosen for the iOS magnifier size.
For the Pixel 7 Pro emulator, the devicePixelRatio is 3.5, and Offset(0, -22 * MediaQuery.of(context).devicePixelRatio) doesn't produce correct results:
The expression produces -77.0 while the value to magnify the correct area is -45, where 45 / 3.5 ~= 13.
@matthew-carroll If we just do -150 / pixelRatio it seems to produce the correct results. -150 is the follower offset.
@matthew-carroll I suggest you reopen the ticket since it is not fixed on ios. The ios fix seems to be implemented in this PR https://github.com/superlistapp/super_editor/pull/1973 cc @angelosilvestre
@matthew-carroll Should this be closed now that https://github.com/superlistapp/super_editor/pull/1973 is merged?
I think so.