-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples: Hide scrollbars in webgl_effects_ascii
.
#25047
Conversation
I think there is no need to replace the controls. The CSS fix is of course good. |
Yes, I think the controls should be replaced with Then, |
I just only keep CSS fix, I think this
Thank you for your reply, the controls code is a little controversial. Let's keep it the same. |
Doing We used to have that in all the examples until we realized the proper solution was doing |
I've tried that but unfortunately it does not work with |
webgl_effects_ascii
.
This seems to do the trick... diff --git a/examples/jsm/effects/AsciiEffect.js b/examples/jsm/effects/AsciiEffect.js
index 1ad06a4b45..af5eb7f02e 100644
--- a/examples/jsm/effects/AsciiEffect.js
+++ b/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');
|
Cool! I can confirm the scroll bars go away with these changes, too! |
@linbingquan Would you mind updating the PR according to @mrdoob's suggestion? |
I'm willing to give it a try. I found |
Yes, so the modifications to the example can be reverted. |
Done. |
Related issue: #XXXX
Description
body
.OrbitControls
to replaceTrackballControls
.I feel
OrbitControls
is easier to use thanTrackballControls
.TBH, I rarely use
TrackballControls
.If there is a problem, I will cancel the second change.