Fixed the Computer updateFocus() interface to keep the page stable unless fScroll is explicitly set
This commit is contained in:
parent
c1b34a87ed
commit
2b24e710d2
5 changed files with 385 additions and 379 deletions
|
|
@ -1404,7 +1404,8 @@ Computer8080.prototype.getMachineComponent = function(sType, componentPrev)
|
|||
* updateFocus(fScroll)
|
||||
*
|
||||
* NOTE: When soft keyboard buttons call us to return focus to the machine (and away from the button),
|
||||
* the scroll feature has annoying effect on iOS, so we no longer do it by default (fScroll must be true).
|
||||
* the browser's default behavior is to scroll the element into view, which can be annoying, especially on iOS,
|
||||
* where the display is more constrained, so we no longer do it by default (fScroll must be true).
|
||||
*
|
||||
* @this {Computer8080}
|
||||
* @param {boolean} [fScroll]
|
||||
|
|
@ -1418,15 +1419,17 @@ Computer8080.prototype.updateFocus = function(fScroll)
|
|||
* is to ensure that keyboard input is fielded properly.
|
||||
*/
|
||||
var x = 0, y = 0;
|
||||
if (fScroll && window) {
|
||||
if (!fScroll && window) {
|
||||
x = window.scrollX;
|
||||
y = window.scrollY;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: We need a mechanism to determine the "active" display, instead of hard-coding this to aVideo[0].
|
||||
*/
|
||||
this.aVideo[0].setFocus();
|
||||
if (fScroll && window) {
|
||||
|
||||
if (!fScroll && window) {
|
||||
window.scrollTo(x, y);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -506,10 +506,15 @@ CPU8080.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
|
|||
this.bindings[sBinding] = control;
|
||||
control.onclick = function onClickRun() {
|
||||
if (!cpu.cmp || !cpu.cmp.checkPower()) return;
|
||||
/*
|
||||
* We no longer pass true to these runCPU()/stopCPU() calls, on the theory that if the "run"
|
||||
* control is visible, then the computer is probably sufficiently visible as well; the problem
|
||||
* with setting fUpdateFocus to true is that it can jerk the web page around in annoying ways.
|
||||
*/
|
||||
if (!cpu.flags.fRunning)
|
||||
cpu.runCPU(true);
|
||||
cpu.runCPU();
|
||||
else
|
||||
cpu.stopCPU(true);
|
||||
cpu.stopCPU();
|
||||
};
|
||||
fBound = true;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -618,9 +618,10 @@ Video8080.prototype.powerUp = function(data, fRepower)
|
|||
* Because the VT100 frame buffer can be located anywhere in RAM (above 0x2000), we must defer this
|
||||
* test code until the powerUp() notification handler is called, when all RAM has (hopefully) been allocated.
|
||||
*
|
||||
* TODO: Remove this display test code once the VT100 is fully operational.
|
||||
* NOTE: The following test screen was useful for early testing, but a *real* VT100 doesn't display a test screen,
|
||||
* so this code is no longer enabled by default. Remove MAXDEBUG if you want to see it again.
|
||||
*/
|
||||
if (this.nFormat == Video8080.FORMAT.VT100) {
|
||||
if (MAXDEBUG && this.nFormat == Video8080.FORMAT.VT100) {
|
||||
/*
|
||||
* Build a test screen in the VT100 frame buffer; we'll mimic the "SET-UP A" screen, since it uses
|
||||
* all the font variations. The process involves iterating over 0-based row numbers -2 (or -5 if 50Hz
|
||||
|
|
|
|||
Loading…
Reference in a new issue