|
@@ -96,6 +96,7 @@ class CSS2DRenderer {
|
|
_viewMatrix.copy( camera.matrixWorldInverse );
|
|
_viewMatrix.copy( camera.matrixWorldInverse );
|
|
_viewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, _viewMatrix );
|
|
_viewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, _viewMatrix );
|
|
|
|
|
|
|
|
+ hideObject( scene );
|
|
renderObject( scene, scene, camera );
|
|
renderObject( scene, scene, camera );
|
|
zOrder( scene );
|
|
zOrder( scene );
|
|
|
|
|
|
@@ -114,15 +115,27 @@ class CSS2DRenderer {
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ function hideObject( object ) {
|
|
|
|
+
|
|
|
|
+ if ( object.isCSS2DObject ) object.element.style.display = 'none';
|
|
|
|
+
|
|
|
|
+ for ( let i = 0, l = object.children.length; i < l; i ++ ) {
|
|
|
|
+
|
|
|
|
+ hideObject( object.children[ i ] );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
function renderObject( object, scene, camera ) {
|
|
function renderObject( object, scene, camera ) {
|
|
|
|
|
|
|
|
+ if ( object.visible === false ) return;
|
|
|
|
+
|
|
if ( object.isCSS2DObject ) {
|
|
if ( object.isCSS2DObject ) {
|
|
|
|
|
|
_vector.setFromMatrixPosition( object.matrixWorld );
|
|
_vector.setFromMatrixPosition( object.matrixWorld );
|
|
_vector.applyMatrix4( _viewProjectionMatrix );
|
|
_vector.applyMatrix4( _viewProjectionMatrix );
|
|
|
|
|
|
- const visible = ( object.visible === true ) && ( _vector.z >= - 1 && _vector.z <= 1 ) && ( object.layers.test( camera.layers ) === true );
|
|
|
|
- object.element.style.display = ( visible === true ) ? '' : 'none';
|
|
|
|
|
|
+ const visible = ( _vector.z >= - 1 && _vector.z <= 1 ) && ( object.layers.test( camera.layers ) === true );
|
|
|
|
|
|
if ( visible === true ) {
|
|
if ( visible === true ) {
|
|
|
|
|
|
@@ -130,6 +143,8 @@ class CSS2DRenderer {
|
|
|
|
|
|
const element = object.element;
|
|
const element = object.element;
|
|
|
|
|
|
|
|
+ element.style.display = '';
|
|
|
|
+
|
|
element.style.transform = 'translate(' + ( - 100 * object.center.x ) + '%,' + ( - 100 * object.center.y ) + '%)' + 'translate(' + ( _vector.x * _widthHalf + _widthHalf ) + 'px,' + ( - _vector.y * _heightHalf + _heightHalf ) + 'px)';
|
|
element.style.transform = 'translate(' + ( - 100 * object.center.x ) + '%,' + ( - 100 * object.center.y ) + '%)' + 'translate(' + ( _vector.x * _widthHalf + _widthHalf ) + 'px,' + ( - _vector.y * _heightHalf + _heightHalf ) + 'px)';
|
|
|
|
|
|
if ( element.parentNode !== domElement ) {
|
|
if ( element.parentNode !== domElement ) {
|