-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
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
Add iOS workaround to BoxGeometry #9196
Conversation
Hmm, there needs to be a better solution that this hack I did in the iOS8 days... /cc @spite |
Found a nicer workaround! c0537d2 |
Cool! Only problem is yours is hard-coded for the examples page. How about my updated version for the documentation pages? More flexible. |
I like it! How about a little bit more compact? scene.style.width = getComputedStyle( scene ).width;
scene.style.height = getComputedStyle( scene ).height;
scene.setAttribute( 'scrolling', 'no' ); |
Done. Shall I begin adding this fix to the other geometries? |
Would the code still work if it was in this form? <iframe id="scene" src="scenes/geometry-browser.html#BoxGeometry"></iframe>
<script>
window.onload = function() {
var scene = document.getElementById( 'scene' );
// iOS iframe auto-resize workaround
if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
scene.style.width = getComputedStyle( scene ).width;
scene.style.height = getComputedStyle( scene ).height;
scene.setAttribute( 'scrolling', 'no' );
}
}
</script> That way the patch/workaround code is independent/separate from the iframe src. |
Since I was using I was previously under the impression that Better? |
Almost! I don't think you need to wait for the onload. The style applied to the iframe doesn't depend on the iframe being loaded. I think you should be able to have the code execute directly. Seems to work fine for the examples page. |
And of course you're right. Another misconception on my part. |
Sweet! |
Thanks! |
And yes, adding it to the other pages would be great! |
Partial fix #9195