mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-26 17:47:40 +00:00
Added some base code toward testing rotation-related events.
This commit is contained in:
parent
23d66d80f3
commit
cf5a2483f7
2 changed files with 47 additions and 2 deletions
|
|
@ -476,18 +476,19 @@ if(!window['keyman']['initialized']) {
|
|||
osk.hideNow();
|
||||
|
||||
// At least on simulators, it seems we can reach a minor race condition on screen-size updates without a timeout.
|
||||
window.setTimeout(function() {
|
||||
//window.setTimeout(function() {
|
||||
keymanweb.alignInputs(true);
|
||||
osk.hideLanguageList();
|
||||
osk._Load();
|
||||
if(osk.wasVisible) {
|
||||
osk._Show();
|
||||
}
|
||||
}, 500);
|
||||
//}, 500);
|
||||
};
|
||||
|
||||
if(device.OS == 'iOS') {
|
||||
util.attachDOMEvent(window, 'orientationchange', rotationHandler);
|
||||
util.attachDOMEvent(window, 'resize', rotationHandler);
|
||||
}
|
||||
|
||||
// Also manage viewport rescaling after rotation on Android
|
||||
|
|
|
|||
44
web/test.html
Normal file
44
web/test.html
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" name="viewport">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<textarea cols=40 rows=20 id='e' style='overflow: scroll'></textarea>
|
||||
|
||||
<script>
|
||||
var e = document.getElementById('e');
|
||||
var lastW, lastH, lastO;
|
||||
var noRecentChange = 100;
|
||||
|
||||
function doLog(event, onlyIfChanged) {
|
||||
if(onlyIfChanged) {
|
||||
if(lastW == window.innerWidth && lastH == window.innerHeight && lastO == window.orientation) {
|
||||
if(noRecentChange == 100) {
|
||||
e.value = e.value + event + ": no-change" + '\n\n';
|
||||
}
|
||||
noRecentChange++;
|
||||
return;
|
||||
}
|
||||
lastW = window.innerWidth;
|
||||
lastH = window.innerHeight;
|
||||
lastO = window.orientation;
|
||||
}
|
||||
e.value = e.value + event + ': w.iw='+window.innerWidth+' w.ih='+window.innerHeight+' w.o='+window.orientation+'\n';
|
||||
e.scrollTop = e.scrollHeight;
|
||||
noRecentChange = 0;
|
||||
}
|
||||
|
||||
window.setInterval(function() {
|
||||
doLog('tick', true);
|
||||
}, 1);
|
||||
|
||||
window.addEventListener('resize', function() { doLog('resize-b', false) }, false);
|
||||
window.addEventListener('resize', function() { doLog('resize-c', false) }, true);
|
||||
window.addEventListener('orientationchange', function() { doLog('orientationchange-b', false) }, false);
|
||||
window.addEventListener('orientationchange', function() { doLog('orientationchange-c', false) }, true);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Reference in a new issue