-
-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
const interval = setInterval(() => { | ||
const viewport = EngineRenderer.instance.renderContext.getParameter( | ||
EngineRenderer.instance.renderContext.VIEWPORT | ||
) | ||
// todo - scrolling in and out sometimes causes weird pixel ratios that can cause this to fail | ||
if (viewport[2] === Math.round(width * pixelRatio) && viewport[3] === Math.round(height * pixelRatio)) { | ||
if (viewport[2] === Math.round(width) && viewport[3] === Math.round(height)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pixel ratio must be preserved here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried this a few times, viewport
comes out to be like 0 0 512 320
and height
and width
are also 320
and 512
respectively but pixelRatio
is 2
. So, the condition is not fulfilled. Also,pixelRatio
is defined outside the promise so it does not change even though the promise inside changes the pixelRatio to 1.
const timeout = setTimeout(() => { | ||
console.warn('Could not resize viewport in time') | ||
clearTimeout(timeout) | ||
clearInterval(interval) | ||
reject() | ||
}, 10000) | ||
|
||
// set up effect composer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this moved earlier up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After testing this a lot of times, the timer functions are called before the resizing of the scene. So, the if
condition above does not ever get satisfied and an error is thrown.
Synchronously calling them does not cause that error.
Summary
References
closes #8656
Checklist
QA Steps
List any additional steps required to QA the changes of this PR, as well as any supplemental images or videos.