Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch was written from an archive.org perspective and fixes two problems in
loader.js
:Calling requestFullscreen
When running Safari, when you hit the Full Screen View button on an active emulator, the following error happens:
TypeError: this._canvas.requestFullscreen is not a function. (In 'this._canvas.requestFullscreen()', 'this._canvas.requestFullscreen' is undefined)
This is because
EmscriptenRunner.requestFullScreen
callsrequestFullscreen
on theCanvas
instead of going throughgetfullscreenenabler()
, which will pick the available (prefixed) version ofrequestFullscreen
.Adjusting the canvas scale
With the first part in place, things work (at least in vMac) but are not scaled properly. This is hard to see on a 16:9 screen but it becomes very obvious on different screen sizes.
The problem is the following, which happens after the canvas is made full screen:
ReferenceError: Can't find variable: scale
This is because the
fullScreenChangeHandler
(inEmulator.setupFullScreen
) can't reference the variables it needs because they are underthis
, which gets lost in the callback. The usual trick is to movethis
in a new variable and then capture that in the callback - that seemed to already be in the code (let self = this;
) partially but is not actually used in the callback.