git auto update

This commit is contained in:
lhy6305 2025-04-18 21:02:33 +08:00
parent 1e0246507f
commit ba9857ad7d
6 changed files with 29 additions and 16 deletions

View File

@ -2,8 +2,8 @@
<head><meta charset="utf-8"> <head><meta charset="utf-8">
<link rel="stylesheet" href="./css/main.css"> <link rel="stylesheet" href="./css/main.css">
<script src="./js/0-loadfail.js"></script> <script src="./js/0-loadfail.js"></script>
<script src="./js/0-jsloader.js"></script> <script src="./js/1-jsloader.js"></script>
<script src="./js/0-jsloadentry.js"></script> <script src="./js/2-jsloadentry.js"></script>
</head><body> </head><body>
<div id="mainframe"><canvas id="maincanvas"></canvas></div> <div id="mainframe"><canvas id="maincanvas"></canvas></div>
</body></html> </body></html>

View File

@ -3,16 +3,16 @@
(function() { (function() {
var do_loadfail=function(msg) { var do_loadfail=function(msg) {
var a=document.createElement("div"); var a=document.createElement("div");
a.style.textAlign="center"; a.style.textAlign="left";
a.style.display="inline-block";
a.style.position="absolute"; a.style.position="absolute";
a.style.zIndex="999999"; a.style.zIndex="999999";
a.style.margin="auto"; a.style.margin="auto";
a.style.color="rgba("+0xff+","+0xff+","+0x00+",1)"; a.style.color="rgba("+0xff+","+0xff+","+0x00+",1)";
a.style.width="100%"; a.style.width="max-content";
a.style.verticalAlign="middle"; a.style.left="0";
a.style.outline="none"; a.style.right="0";
a.style.top="20vh"; a.style.top="50%";
a.style.transform="translateY(-50%)";
a.style.fontSize="20px"; a.style.fontSize="20px";
a.style.lineHeight="25px"; a.style.lineHeight="25px";
a.style.whiteSpace="pre"; a.style.whiteSpace="pre";
@ -20,6 +20,8 @@
document.body.innerHTML=""; document.body.innerHTML="";
document.body.style.backgroundColor="rgba("+0x75+","+0x60+","+0x60+",1)"; document.body.style.backgroundColor="rgba("+0x75+","+0x60+","+0x60+",1)";
document.body.style.height="100vh";
document.body.style.margin="0";
document.body.appendChild(a); document.body.appendChild(a);
}; };

View File

@ -50,10 +50,10 @@
if(libmain.settings.use_fixed_aspect_ratio) { if(libmain.settings.use_fixed_aspect_ratio) {
res=libutil.calcresize(document.body.clientWidth, document.body.clientHeight, libmain.settings.fixed_ratio); res=libutil.calcresize(document.body.clientWidth, document.body.clientHeight, libmain.settings.fixed_ratio);
} }
mainframe.style.width=res[0]+"px"; libmain.mainframe.style.width=res[0]+"px";
mainframe.style.height=res[1]+"px"; libmain.mainframe.style.height=res[1]+"px";
mainframe.style.left=res[2]+"px"; libmain.mainframe.style.left=res[2]+"px";
mainframe.style.top=res[3]+"px"; libmain.mainframe.style.top=res[3]+"px";
}; };
window.addEventListener("resize", libmain.resize); window.addEventListener("resize", libmain.resize);
@ -73,13 +73,13 @@
libmain.stageroot.sortableChildren=true; libmain.stageroot.sortableChildren=true;
libmain.render=function() { libmain.render=function() {
try { try {
libmain.renderer.render(libmain.stageroot); libmain.renderer.render(libmain.stageroot1);
} catch(e) { } catch(e) {
console.error(e); console.error(e);
if(typeof loadfail=="function") { if(typeof loadfail=="function") {
loadfail(e.message+"\n"+e.stack); loadfail(libutil.error2str(e));
} else { } else {
window.alert(e.message+"\n"+e.stack); window.alert(libutil.error2str(e));
} }
return; return;
} }

View File

@ -9,7 +9,7 @@
libutil.clamp=function(val, min, max) { libutil.clamp=function(val, min, max) {
if(window.EnableDebugMode) { if(window.EnableDebugMode) {
if(max<min) { if(max<min) {
console.warn("ibutil.clamp(): the max value is less than the min value"); console.warn("clamp(): the max value is less than the min value");
var min1 = Math.min(min, max); var min1 = Math.min(min, max);
var max1 = Math.max(min, max); var max1 = Math.max(min, max);
return Math.min(Math.max(val, min1), max1); return Math.min(Math.max(val, min1), max1);
@ -28,6 +28,17 @@
} }
}; };
libutil.error2str=function(e) {
if(window.EnableDebugMode&&(typeof e!=="object"||e==null)) {
console.error("error2str(): the provided param is not an object");
return String(e);
}
var name=e.name||"<Error Name not Set>";
var message=e.message||"<No error message available>";
var stack=e.stack||["<Not Available>"];
return name+": "+message+"\n\nStack Trace: \n"+"- "+stack.trim().split("\n").join("\n- ")+"\n\nCheck the developer console for detailed information.";
};
window.libutil=libutil; window.libutil=libutil;
})(); })();