From 3a35279a6c9d620e1389ffd13361ee0f71bb032c Mon Sep 17 00:00:00 2001 From: Yueyu Date: Sat, 4 Sep 2021 07:27:54 +0800 Subject: [PATCH] change to 45% of the window.innerHeight to show color and font size menu --- src/editor/engine/Sprite.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/editor/engine/Sprite.js b/src/editor/engine/Sprite.js index b990777..91dac56 100755 --- a/src/editor/engine/Sprite.js +++ b/src/editor/engine/Sprite.js @@ -915,7 +915,9 @@ export default class Sprite { } 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) { + // 0.45 is a magic number and we should compare the bottom Y of the textbox VS + // WINDOW_INNER_HEIGHT substract the keyboard height. + if (gn('textbox').offsetTop + gn('textbox').offsetHeight > WINDOW_INNER_HEIGHT * 0.45) { // 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);