From a1d989c6c140b45afca1ec12617ffbc6993dbf92 Mon Sep 17 00:00:00 2001 From: jahorton Date: Thu, 13 May 2021 09:02:54 +0700 Subject: [PATCH 1/2] fix(web): popup key positioning logic --- web/source/osk/visualKeyboard.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web/source/osk/visualKeyboard.ts b/web/source/osk/visualKeyboard.ts index 3870e441d2..5db2331f84 100644 --- a/web/source/osk/visualKeyboard.ts +++ b/web/source/osk/visualKeyboard.ts @@ -1789,8 +1789,12 @@ namespace com.keyman.osk { // And correct its position with respect to that element ss=subKeys.style; - var x=dom.Utils.getAbsoluteX(e)+0.5*(e.offsetWidth-subKeys.offsetWidth), y, - xMax=(util.landscapeView()?screen.height:screen.width)-subKeys.offsetWidth; + var x=dom.Utils.getAbsoluteX(e)+0.5*(e.offsetWidth-subKeys.offsetWidth); + + // https://stackoverflow.com/questions/28083715/how-to-detect-if-a-mobile-device-is-emulated-by-google-chrome + // (Note the last reply to the accepted answer.) + var flipScreenDims = util.landscapeView() && util.device.OS == 'iOS' && navigator.maxTouchPoints !== 1; + var xMax= (flipScreenDims ? screen.height : screen.width) - subKeys.offsetWidth; if(x > xMax) { x=xMax; From 3102435314217717cbdede5727e52f4c791cba0b Mon Sep 17 00:00:00 2001 From: jahorton Date: Thu, 13 May 2021 11:54:02 +0700 Subject: [PATCH 2/2] fix(web): reuses OSK width calc --- web/source/osk/visualKeyboard.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/web/source/osk/visualKeyboard.ts b/web/source/osk/visualKeyboard.ts index 5db2331f84..9a7b493448 100644 --- a/web/source/osk/visualKeyboard.ts +++ b/web/source/osk/visualKeyboard.ts @@ -1789,12 +1789,8 @@ namespace com.keyman.osk { // And correct its position with respect to that element ss=subKeys.style; - var x=dom.Utils.getAbsoluteX(e)+0.5*(e.offsetWidth-subKeys.offsetWidth); - - // https://stackoverflow.com/questions/28083715/how-to-detect-if-a-mobile-device-is-emulated-by-google-chrome - // (Note the last reply to the accepted answer.) - var flipScreenDims = util.landscapeView() && util.device.OS == 'iOS' && navigator.maxTouchPoints !== 1; - var xMax= (flipScreenDims ? screen.height : screen.width) - subKeys.offsetWidth; + var x = dom.Utils.getAbsoluteX(e)+0.5*(e.offsetWidth-subKeys.offsetWidth); + var xMax = keyman.osk.getWidth() - subKeys.offsetWidth; if(x > xMax) { x=xMax;