iOS: scroll up a little bit if the textbox is on the bottom part of the screen

This commit is contained in:
Yueyu 2021-09-02 20:52:24 +08:00
parent ce9200b2f1
commit f40757c50f

View file

@ -913,6 +913,13 @@ export default class Sprite {
me.unfocusText();
});
} else {
// On iOS if the bottom of the textbox is lower than half of the screen
// the color and font size menu may be covered by the keyboard
if (gn('textbox').offsetTop + gn('textbox').offsetHeight > WINDOW_INNER_HEIGHT / 2) {
// scroll up a little more than the textbox height
// to show the color menu and font size menu.
window.scroll(0, gn('textbox').offsetHeight * 1.2);
}
if (isTablet) {
ti.focus();
} else {