to:sync
This commit is contained in:
parent
574613cb20
commit
052fe1a496
@ -297,7 +297,8 @@ export class MyUtils {
|
||||
let nowFrontSize = ((curClientW / designWidth) / 10) + 'px';
|
||||
curDoc.style.fontSize = nowFrontSize;
|
||||
console.log("curClientW :", curClientW, "designWidth: ", designWidth, "-> ", nowFrontSize);
|
||||
// let testDiv = document.getElementById("testDevice")
|
||||
let testDiv = document.getElementById("testDevice");
|
||||
testDiv.innerText += "\nnowFrontSize: " + nowFrontSize;
|
||||
// testDiv.innerText = testDiv.innerText +
|
||||
// // "\n navigator_userAgent :" + navigator.userAgent.toLocaleLowerCase() +
|
||||
// "\n isMobile :" + /mobi|android|iphone|ipad|ipod/i.test(navigator.userAgent.toLocaleLowerCase()) +
|
||||
@ -331,17 +332,29 @@ export class MyUtils {
|
||||
}
|
||||
}
|
||||
|
||||
let myEditFrontSize = document.getElementById("myEdit_main");
|
||||
if (document.documentElement.clientWidth <= 720) {
|
||||
myEditFrontSize.style.fontSize = (window.myEdit.ctx.editFrontSize + 6) + 'px';
|
||||
} else {
|
||||
myEditFrontSize.style.fontSize = window.myEdit.ctx.editFrontSize * dpr + 'px';
|
||||
let curDoc = document.documentElement;//当前文档的 root 元素
|
||||
let curClientW = curDoc.clientWidth;
|
||||
if (!curClientW) {
|
||||
return
|
||||
}
|
||||
|
||||
let designWidth = window.myEdit.ctx.designWith;
|
||||
//set 1rem = viewWidth/10 (支持响应式)
|
||||
let scaleFactor = curClientW / designWidth;
|
||||
|
||||
let myEditFrontSize = document.getElementById("myEdit_main");
|
||||
// if (document.documentElement.clientWidth <= 720) {
|
||||
// myEditFrontSize.style.fontSize = (window.myEdit.ctx.editFrontSize + 6) + 'px';
|
||||
// } else {
|
||||
// myEditFrontSize.style.fontSize = window.myEdit.ctx.editFrontSize * dpr + 'px';
|
||||
// }
|
||||
// myEditFrontSize.style.fontSize = window.myEdit.ctx.editFrontSize * dpr + 'px';
|
||||
myEditFrontSize.style.fontSize = window.myEdit.ctx.editFrontSize * scaleFactor + 'px';
|
||||
|
||||
|
||||
console.log("myEditFrontSize: ", myEditFrontSize.style.fontSize);
|
||||
let testDiv = document.getElementById("testDevice");
|
||||
testDiv.innerText = "\nmyEditFrontSize:" + myEditFrontSize.style.fontSize;
|
||||
testDiv.innerText += "\nmyEditFrontSize:" + myEditFrontSize.style.fontSize;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,7 +31,7 @@ import {MyEventListener} from "./event/MyEventListener.js";
|
||||
/**
|
||||
* 默认body front-size 单位px
|
||||
*/
|
||||
editFrontSize: 12,
|
||||
editFrontSize: 16,
|
||||
/**
|
||||
* 设计稿宽度 375
|
||||
*/
|
||||
@ -173,7 +173,7 @@ window.onload = function () {
|
||||
* 使用说明
|
||||
*/
|
||||
let testDiv = document.getElementById("testDevice");
|
||||
testDiv.innerText += "\n\n ### info ###"+
|
||||
testDiv.innerText += "\n\n ### info ###" +
|
||||
"\n'#空格': h1" +
|
||||
"\n'##空格': h2" +
|
||||
"\n'###空格': h3" +
|
||||
|
@ -121,7 +121,7 @@
|
||||
|
||||
<main id="myEdit_main">
|
||||
<!-- 标题 -->
|
||||
<h3 style=" border: 1px blanchedalmond solid;">
|
||||
<h3>
|
||||
测试编辑
|
||||
</h3>
|
||||
<!-- 内容 -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user