Ver código fonte

Editor: Fixed sidebar resizing in VR

Mr.doob 4 anos atrás
pai
commit
e1a99a1b15
3 arquivos alterados com 15 adições e 9 exclusões
  1. 13 1
      editor/js/Viewport.VR.js
  2. 1 7
      editor/js/libs/three.html.js
  3. 1 1
      editor/sw.js

+ 13 - 1
editor/js/Viewport.VR.js

@@ -21,12 +21,18 @@ class VR {
 
 		const onSessionStarted = async ( session ) => {
 
+			const sidebar = document.getElementById( 'sidebar' );
+			sidebar.style.width = '300px';
+			sidebar.style.height = '700px';
+
+			//
+
 			if ( group === null ) {
 
 				group = new THREE.Group();
 				editor.sceneHelpers.add( group );
 
-				const mesh = new HTMLMesh( document.getElementById( 'sidebar' ), 300, 700 );
+				const mesh = new HTMLMesh( sidebar );
 				mesh.position.set( 1, 1.5, - 0.5 );
 				mesh.rotation.y = - 0.5;
 				group.add( mesh );
@@ -76,6 +82,12 @@ class VR {
 
 		const onSessionEnded = async () => {
 
+			const sidebar = document.getElementById( 'sidebar' );
+			sidebar.style.width = '';
+			sidebar.style.height = '';
+
+			//
+
 			editor.camera.copy( camera );
 
 			group.visible = false;

+ 1 - 7
editor/js/libs/three.html.js

@@ -2,16 +2,10 @@ import * as THREE from '../../../build/three.module.js';
 
 class HTMLMesh extends THREE.Mesh {
 
-	constructor( dom, width, height ) {
-
-		dom.style.width = width + 'px';
-		dom.style.height = height + 'px';
+	constructor( dom ) {
 
 		const texture = new HTMLTexture( dom );
 
-		dom.style.width = '';
-		dom.style.height = '';
-
 		const geometry = new THREE.PlaneGeometry( texture.image.width * 0.002, texture.image.height * 0.002 );
 		const material = new THREE.MeshBasicMaterial( { map: texture, toneMapped: false } );
 

+ 1 - 1
editor/sw.js

@@ -1,4 +1,4 @@
-// r126
+// r126.1
 
 const assets = [
 	'./',