From 787b361b09d4f5f0481568dd5306db4f7d7a78c1 Mon Sep 17 00:00:00 2001 From: Kevin Levron Date: Sun, 21 Feb 2021 13:47:04 +0100 Subject: [PATCH] change resize handler --- src/core/Renderer.js | 2 +- src/core/useThree.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/Renderer.js b/src/core/Renderer.js index 608a855..f07d814 100644 --- a/src/core/Renderer.js +++ b/src/core/Renderer.js @@ -9,7 +9,7 @@ export default { mouseMove: { type: [Boolean, String], default: false }, mouseRaycast: { type: Boolean, default: false }, orbitCtrl: { type: [Boolean, Object], default: false }, - resize: { type: [Boolean, String, Element], default: 'window' }, + resize: { type: [Boolean, String], default: true }, shadow: Boolean, width: String, height: String, diff --git a/src/core/useThree.js b/src/core/useThree.js index 375c813..1da7255 100644 --- a/src/core/useThree.js +++ b/src/core/useThree.js @@ -21,7 +21,7 @@ export default function useThree() { orbit_ctrl: false, mouse_move: false, mouse_raycast: false, - resize: 'window', + resize: true, width: 0, height: 0, }; @@ -222,7 +222,8 @@ export default function useThree() { if (conf.resize === 'window') { setSize(window.innerWidth, window.innerHeight); } else { - setSize(conf.resize.clientWidth, conf.resize.clientHeight); + const elt = obj.renderer.domElement.parentNode; + setSize(elt.clientWidth, elt.clientHeight); } afterResizeCallbacks.forEach(c => c()); }