fix(web): popup key positioning logic

This commit is contained in:
jahorton 2021-05-13 09:02:54 +07:00
parent 76f907cc0e
commit 8dff00c93d

View file

@ -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;