From ece3164f22e8f36a105a1f605355df1d4f239c61 Mon Sep 17 00:00:00 2001 From: Kevin Levron Date: Wed, 7 Oct 2020 23:39:25 +0200 Subject: [PATCH] update useThree --- src/core/useThree.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core/useThree.js b/src/core/useThree.js index 9ed78f1..375c813 100644 --- a/src/core/useThree.js +++ b/src/core/useThree.js @@ -34,7 +34,7 @@ export default function useThree() { }; // handlers - let afterInitCallbacks = []; + const afterInitCallbacks = []; let afterResizeCallbacks = []; let beforeRenderCallbacks = []; @@ -243,8 +243,13 @@ export default function useThree() { obj.composer.setSize(width, height); } - const wsize = getCameraSize(); - size.wWidth = wsize[0]; size.wHeight = wsize[1]; + if (obj.camera.type === 'OrthographicCamera') { + size.wWidth = obj.camera.right - obj.camera.left; + size.wHeight = obj.camera.top - obj.camera.bottom; + } else { + const wsize = getCameraSize(); + size.wWidth = wsize[0]; size.wHeight = wsize[1]; + } } /**