Conversation
|
There is something really odd happening in Safari it seems the emulator goes into fullscreen mode a couple of times. And when you exit (by hitting escape) the browser seems very confused about the full screen state. I thought it had something to do with the |
|
Interestingly when I patch archive.org, the weird Safari thing where it goes in and out of fullscreen mode multiple times does not happen. Go to for example https://archive.org/details/hypercard_virus-reference-214 Then in the web inspector, alias Now you can succesfully put the emulator in full screen mode. Except the scaling / aspect ratio is broken because of the second bug. (I don't know how to hot-patch that to try) |
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.requestFullScreencallsrequestFullscreenon theCanvasinstead 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: scaleThis 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 movethisin 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.