mirror of
https://github.com/kou029w/pucchinglgl.git
synced 2025-01-18 16:18:00 +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.updateProjectionMatrix();
|
||||
adjustPanelSize();
|
||||
|
@ -103,11 +104,10 @@ function setup() {
|
|||
scene.clear();
|
||||
scene.add(...panels);
|
||||
camera.position.z = 1;
|
||||
adjustCanvasSize();
|
||||
adjustRendererSize();
|
||||
}
|
||||
|
||||
function main() {
|
||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
Object.assign(canvas.style, { width: "100%", height: "100%" });
|
||||
root.addEventListener("keydown", handleKeydown);
|
||||
root.addEventListener("touchstart", handleTouchmove, { passive: false });
|
||||
|
@ -125,7 +125,7 @@ function main() {
|
|||
}
|
||||
root.appendChild(canvas);
|
||||
Object.assign(root.style, { overflow: "hidden", overscrollBehavior: "none" });
|
||||
window.addEventListener("resize", adjustCanvasSize);
|
||||
window.addEventListener("resize", adjustRendererSize);
|
||||
setup();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue