Merge branch 'master' into gh-pages

This commit is contained in:
Jeff Parsons 2017-06-25 10:18:30 -07:00
commit e87663bd2f
8 changed files with 758 additions and 720 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -2765,8 +2765,8 @@ class Video extends Component {
/*
* Using desktop mouse events to simulate touch events should only be enabled as needed.
*
if (DEBUG) {
*/
if (MAXDEBUG) {
control.addEventListener(
'mousedown',
function onMouseDown(event) { video.onTouchStart(event); },
@ -2783,7 +2783,6 @@ class Video extends Component {
false // we'll specify false for the 'useCapture' parameter for now...
);
}
*/
// this.log("touch events captured");
@ -2940,12 +2939,21 @@ class Video extends Component {
if (this.nTouchConfig == Video.TOUCH.KEYGRID) {
/*
* We don't want to simulate a key on EVERY touch event; preferably, only touchstart or touchend. And
* I probably would have preferred triggering key presses on touchend, so that if you decided to move
* your finger off-screen before releasing, you could avoid a key press, but sadly (as I've documented in
* the Mandelbot project; see https://github.com/jeffpar/mandelbot/blob/master/src/mandelbot.js),
* touchend doesn't reliably provide coordinates on all platforms, so we're going to go with touchstart.
*/
if (fStart) {
var xThird = (xTouch / (this.cxScreen / 3)) | 0;
var yThird = (yTouch / (this.cyScreen / 3)) | 0;
/*
* At this point, xThird and yThird should both be one of 0, 1 or 2, indicating which horizontal and vertical
* third of the virtual screen the touch event occurred.
* At this point, xThird and yThird should both be one of 0, 1 or 2, indicating which horizontal and
* vertical third of the virtual screen the touch event occurred.
*/
if (/* xThird == 1 && */ yThird != 1) {
if (!yThird) {
@ -2960,7 +2968,18 @@ class Video extends Component {
this.kbd.addActiveKey(Keyboard.CLICKCODES.RIGHT, true);
}
}
else {
/*
* Why simulate a SPACE if the tap is in the middle third of the screen? Well, apparently I
* didn't explain earlier that the WHOLE reason I originally added KEYGRID support (before it was
* even called KEYGRID support) was to make the 1985 game "Rogue" (pcjs.org/apps/pcx86/1985/rogue)
* more fun to play on an iPad, because arrows and spaces are the most commonly used keys.
*/
this.kbd.addActiveKey(Keyboard.SIMCODE.SPACE, true);
}
}
} else {
if (this.mouse) {
/*
* As long as fTouchDefault is false, we call preventDefault() on every touch event, to keep

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -49187,8 +49187,8 @@ class Video extends Component {
/*
* Using desktop mouse events to simulate touch events should only be enabled as needed.
*
if (DEBUG) {
*/
if (MAXDEBUG) {
control.addEventListener(
'mousedown',
function onMouseDown(event) { video.onTouchStart(event); },
@ -49205,7 +49205,6 @@ class Video extends Component {
false // we'll specify false for the 'useCapture' parameter for now...
);
}
*/
// this.log("touch events captured");
@ -49362,12 +49361,21 @@ class Video extends Component {
if (this.nTouchConfig == Video.TOUCH.KEYGRID) {
/*
* We don't want to simulate a key on EVERY touch event; preferably, only touchstart or touchend. And
* I probably would have preferred triggering key presses on touchend, so that if you decided to move
* your finger off-screen before releasing, you could avoid a key press, but sadly (as I've documented in
* the Mandelbot project; see https://github.com/jeffpar/mandelbot/blob/master/src/mandelbot.js),
* touchend doesn't reliably provide coordinates on all platforms, so we're going to go with touchstart.
*/
if (fStart) {
var xThird = (xTouch / (this.cxScreen / 3)) | 0;
var yThird = (yTouch / (this.cyScreen / 3)) | 0;
/*
* At this point, xThird and yThird should both be one of 0, 1 or 2, indicating which horizontal and vertical
* third of the virtual screen the touch event occurred.
* At this point, xThird and yThird should both be one of 0, 1 or 2, indicating which horizontal and
* vertical third of the virtual screen the touch event occurred.
*/
if (/* xThird == 1 && */ yThird != 1) {
if (!yThird) {
@ -49382,7 +49390,18 @@ class Video extends Component {
this.kbd.addActiveKey(Keyboard.CLICKCODES.RIGHT, true);
}
}
else {
/*
* Why simulate a SPACE if the tap is in the middle third of the screen? Well, apparently I
* didn't explain earlier that the WHOLE reason I originally added KEYGRID support (before it was
* even called KEYGRID support) was to make the 1985 game "Rogue" (pcjs.org/apps/pcx86/1985/rogue)
* more fun to play on an iPad, because arrows and spaces are the most commonly used keys.
*/
this.kbd.addActiveKey(Keyboard.SIMCODE.SPACE, true);
}
}
} else {
if (this.mouse) {
/*
* As long as fTouchDefault is false, we call preventDefault() on every touch event, to keep

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long