Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Mar 18, 2021
1 parent a87f87b commit 024cfe8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/js/renderers/CSS2DRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,14 @@ THREE.CSS2DRenderer = function () {
var element = object.element;

if ( /apple/i.test( navigator.vendor ) ) {

// https://github.com/mrdoob/three.js/issues/21415
element.style.transform = 'translate(-50%,-50%) translate(' + Math.round( vector.x * _widthHalf + _widthHalf ) + 'px,' + Math.round( - vector.y * _heightHalf + _heightHalf ) + 'px)';

} else {

element.style.transform = 'translate(-50%,-50%) translate(' + ( vector.x * _widthHalf + _widthHalf ) + 'px,' + ( - vector.y * _heightHalf + _heightHalf ) + 'px)';

}

element.style.display = ( object.visible && vector.z >= - 1 && vector.z <= 1 ) ? '' : 'none';
Expand Down
4 changes: 4 additions & 0 deletions examples/jsm/renderers/CSS2DRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,14 @@ var CSS2DRenderer = function () {
var element = object.element;

if ( /apple/i.test( navigator.vendor ) ) {

// https://github.com/mrdoob/three.js/issues/21415
element.style.transform = 'translate(-50%,-50%) translate(' + Math.round( vector.x * _widthHalf + _widthHalf ) + 'px,' + Math.round( - vector.y * _heightHalf + _heightHalf ) + 'px)';

} else {

element.style.transform = 'translate(-50%,-50%) translate(' + ( vector.x * _widthHalf + _widthHalf ) + 'px,' + ( - vector.y * _heightHalf + _heightHalf ) + 'px)';

}

element.style.display = ( object.visible && vector.z >= - 1 && vector.z <= 1 ) ? '' : 'none';
Expand Down

0 comments on commit 024cfe8

Please sign in to comment.