This commit is contained in:
shaoyongjun 2024-10-31 21:41:59 +08:00
parent 5ef7c67472
commit ba6491650c

View File

@ -340,50 +340,63 @@ export class MyUtils {
console.log("body-frontSize: ", myEditFrontSize.style.fontSize); console.log("body-frontSize: ", myEditFrontSize.style.fontSize);
let testDiv = document.getElementById("testDevice"); if (window.myEdit.ctx.isMobile) {
var resizeHeight = document.documentElement.clientHeight || document.body.clientHeight; let testDiv = document.getElementById("testDevice");
if (window.myEdit.ctx.originHeight < resizeHeight) { var resizeHeight = document.documentElement.clientHeight || document.body.clientHeight;
console.log('Android 键盘收起啦!'); if (window.myEdit.ctx.originHeight < resizeHeight) {
testDiv.innerText = "\nmobile: " + 'Android 键盘收起啦!' + console.log('Android 键盘收起啦!');
"\noriginHeight " + window.myEdit.ctx.originHeight + testDiv.innerText = "\nmobile: " + 'Android 键盘收起啦!' +
"\nresizeHeight:" + resizeHeight + "\noriginHeight " + window.myEdit.ctx.originHeight +
"\ninnerHeight:" + window.innerHeight + "\nresizeHeight:" + resizeHeight +
"\nvisualViewport.height: " + window.visualViewport.height "\ninnerHeight:" + window.innerHeight +
// Android 键盘收起后操作 "\nvisualViewport.height: " + window.visualViewport.height
let styleUtils = document.getElementById("_style_utils"); // Android 键盘收起后操作
styleUtils.style.display = "none"; let styleUtils = document.getElementById("_style_utils");
} else { styleUtils.style.display = "none";
console.log('Android 键盘弹起啦!'); setTimeout(() => {
testDiv.innerText = "\nmobile: " + 'Android 键盘弹起啦!' + this.keyBoardHeight = window.innerHeight - window.visualViewport.height;
"\noriginHeight " + window.myEdit.ctx.originHeight + // console.log("mobile: ", this.keyBoardHeight);
"\nresizeHeight " + resizeHeight +
"\ninnerHeight:" + window.innerHeight +
"\nvisualViewport.height: " + window.visualViewport.height
testDiv.innerText = "\n键盘收起啦mobile: " + this.keyBoardHeight +
"\noriginHeight " + window.myEdit.ctx.originHeight +
"\nresizeHeight " + resizeHeight +
"\ninnerHeight:" + window.innerHeight +
"\nvisualViewport.height: " + window.visualViewport.height
// Android 键盘弹起后操作 let styleUtils = document.getElementById("_style_utils");
setTimeout(() => { styleUtils.style.display = "none";
this.keyBoardHeight = window.innerHeight - window.visualViewport.height; }, 800);
// console.log("mobile: ", this.keyBoardHeight); } else {
console.log('Android 键盘弹起啦!');
testDiv.innerText = "\nmobile: " + this.keyBoardHeight + testDiv.innerText = "\nmobile: " + 'Android 键盘弹起啦!' +
"\noriginHeight " + window.myEdit.ctx.originHeight + "\noriginHeight " + window.myEdit.ctx.originHeight +
"\nresizeHeight " + resizeHeight + "\nresizeHeight " + resizeHeight +
"\ninnerHeight:" + window.innerHeight + "\ninnerHeight:" + window.innerHeight +
"\nvisualViewport.height: " + window.visualViewport.height "\nvisualViewport.height: " + window.visualViewport.height
let styleUtils = document.getElementById("_style_utils"); // Android 键盘弹起后操作
styleUtils.style.display = "block"; setTimeout(() => {
// styleUtils.style.left = 0; this.keyBoardHeight = window.innerHeight - window.visualViewport.height;
styleUtils.style.bottom = "600px"; // console.log("mobile: ", this.keyBoardHeight);
}, 800);
testDiv.innerText = "\n键盘弹起啦mobile: " + this.keyBoardHeight +
"\noriginHeight " + window.myEdit.ctx.originHeight +
"\nresizeHeight " + resizeHeight +
"\ninnerHeight:" + window.innerHeight +
"\nvisualViewport.height: " + window.visualViewport.height
// styleUtils.style.left = 0;
let styleUtils = document.getElementById("_style_utils");
styleUtils.style.display = "block";
styleUtils.style.bottom = "500px";
}, 800);
}
window.myEdit.ctx.originHeight = resizeHeight;
} }
window.myEdit.ctx.originHeight = resizeHeight;
} }
/** /**