mirror of
https://github.com/kou029w/pucchinglgl.git
synced 2025-01-19 00:27:59 +00:00
fix: adjustRendererSize
This commit is contained in:
parent
e8d8f5bb1b
commit
025a9c511b
1 changed files with 4 additions and 4 deletions
|
@ -91,7 +91,8 @@ function adjustPanelSize() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function adjustCanvasSize() {
|
function adjustRendererSize() {
|
||||||
|
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||||
camera.aspect = canvas.clientWidth / canvas.clientHeight;
|
camera.aspect = canvas.clientWidth / canvas.clientHeight;
|
||||||
camera.updateProjectionMatrix();
|
camera.updateProjectionMatrix();
|
||||||
adjustPanelSize();
|
adjustPanelSize();
|
||||||
|
@ -103,11 +104,10 @@ function setup() {
|
||||||
scene.clear();
|
scene.clear();
|
||||||
scene.add(...panels);
|
scene.add(...panels);
|
||||||
camera.position.z = 1;
|
camera.position.z = 1;
|
||||||
adjustCanvasSize();
|
adjustRendererSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
|
||||||
Object.assign(canvas.style, { width: "100%", height: "100%" });
|
Object.assign(canvas.style, { width: "100%", height: "100%" });
|
||||||
root.addEventListener("keydown", handleKeydown);
|
root.addEventListener("keydown", handleKeydown);
|
||||||
root.addEventListener("touchstart", handleTouchmove, { passive: false });
|
root.addEventListener("touchstart", handleTouchmove, { passive: false });
|
||||||
|
@ -125,7 +125,7 @@ function main() {
|
||||||
}
|
}
|
||||||
root.appendChild(canvas);
|
root.appendChild(canvas);
|
||||||
Object.assign(root.style, { overflow: "hidden", overscrollBehavior: "none" });
|
Object.assign(root.style, { overflow: "hidden", overscrollBehavior: "none" });
|
||||||
window.addEventListener("resize", adjustCanvasSize);
|
window.addEventListener("resize", adjustRendererSize);
|
||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue