Răsfoiți Sursa

Examples: Hide scrollbars in `webgl_effects_ascii`. (#25047)

* Examples: Improved webgl_effects_ascii.html

* Reverted `controls` code.

* Update webgl_effects_ascii.html

* AsciiEffect: Improved with mrdoob's suggestion code.

* Reverted style code.

Co-authored-by: Michael Herzog <[email protected]>
linbingquan 2 ani în urmă
părinte
comite
9d332c1c72
1 a modificat fișierele cu 3 adăugiri și 6 ștergeri
  1. 3 6
      examples/jsm/effects/AsciiEffect.js

+ 3 - 6
examples/jsm/effects/AsciiEffect.js

@@ -59,8 +59,8 @@ class AsciiEffect {
 
 		function initAsciiSize() {
 
-			iWidth = Math.round( width * fResolution );
-			iHeight = Math.round( height * fResolution );
+			iWidth = Math.floor( width * fResolution );
+			iHeight = Math.floor( height * fResolution );
 
 			oCanvas.width = iWidth;
 			oCanvas.height = iHeight;
@@ -81,9 +81,6 @@ class AsciiEffect {
 			oAscii.cellPadding = 0;
 
 			const oStyle = oAscii.style;
-			oStyle.display = 'inline';
-			oStyle.width = Math.round( iWidth / fResolution * iScale ) + 'px';
-			oStyle.height = Math.round( iHeight / fResolution * iScale ) + 'px';
 			oStyle.whiteSpace = 'pre';
 			oStyle.margin = '0px';
 			oStyle.padding = '0px';
@@ -251,7 +248,7 @@ class AsciiEffect {
 
 			}
 
-			oAscii.innerHTML = '<tr><td>' + strChars + '</td></tr>';
+			oAscii.innerHTML = `<tr><td style="display:block;width:${width}px;height:${height}px;overflow:hidden">${strChars}</td></tr>`;
 
 			// console.timeEnd('rendering');