mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
minor fixes
This commit is contained in:
parent
e2ba308f02
commit
33883242c7
|
@ -213,6 +213,7 @@ canvas {
|
|||
}
|
||||
|
||||
#screen:-webkit-full-screen {
|
||||
background-color: black;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
|
@ -632,10 +633,6 @@ button:focus {
|
|||
display: none;
|
||||
}
|
||||
|
||||
#textarea textarea {
|
||||
font-family: courier;
|
||||
}
|
||||
|
||||
#http_url {
|
||||
width: 500px;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import MicroModal from 'micromodal';
|
||||
|
||||
import { base64_json_parse, base64_json_stringify } from '../base64';
|
||||
import Audio from './audio';
|
||||
import { Audio, SOUND_ENABLED_OPTION } from './audio';
|
||||
import DriveLights from './drive_lights';
|
||||
import { byte, DISK_FORMATS, includes, word } from '../types';
|
||||
import { initGamepad, GamepadConfiguration } from './gamepad';
|
||||
|
@ -490,7 +490,7 @@ export function toggleShowFPS() {
|
|||
|
||||
export function toggleSound() {
|
||||
const on = !audio.isEnabled();
|
||||
optionsModal.setOption('AUDIO_ENABLE', on);
|
||||
optionsModal.setOption(SOUND_ENABLED_OPTION, on);
|
||||
updateSoundButton(on);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import { debug } from '../util';
|
|||
const SAMPLE_SIZE = 1024;
|
||||
const SAMPLE_RATE = 44000;
|
||||
|
||||
const SOUND_ENABLED_OPTION = 'enable_sound';
|
||||
export const SOUND_ENABLED_OPTION = 'enable_sound';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
|
@ -30,7 +30,7 @@ declare global {
|
|||
|
||||
const AudioContext = window.AudioContext || window.webkitAudioContext;
|
||||
|
||||
export default class Audio implements OptionHandler {
|
||||
export class Audio implements OptionHandler {
|
||||
private sound = true;
|
||||
private samples: number[][] = [];
|
||||
|
||||
|
|
|
@ -216,7 +216,6 @@ type Key = Key2 | Key2e;
|
|||
type KeyFunction = (key: KeyboardEvent) => void
|
||||
|
||||
export default class KeyBoard {
|
||||
private focused: boolean = false;
|
||||
private kb: HTMLElement;
|
||||
private keys;
|
||||
|
||||
|
@ -237,11 +236,6 @@ export default class KeyBoard {
|
|||
|
||||
window.addEventListener('keydown', this.keydown);
|
||||
window.addEventListener('keyup', this.keyup);
|
||||
|
||||
document.querySelectorAll('input,textarea').forEach((input) => {
|
||||
input.addEventListener('focus', () => { this.focused = true; });
|
||||
input.addEventListener('blur', () => { this.focused = false; });
|
||||
});
|
||||
}
|
||||
|
||||
setFunction(key: string, fn: KeyFunction) {
|
||||
|
@ -514,12 +508,16 @@ export default class KeyBoard {
|
|||
};
|
||||
}
|
||||
|
||||
private dialogOpen() {
|
||||
return !!document.querySelector('.modal.is-open');
|
||||
}
|
||||
|
||||
private genMouseUp(target: HTMLElement) {
|
||||
return () => target.classList.remove('pressed');
|
||||
}
|
||||
|
||||
private keydown = (evt: KeyboardEvent) => {
|
||||
if (!this.focused && (!evt.metaKey || evt.ctrlKey || this.e)) {
|
||||
if (!this.dialogOpen() && (!evt.metaKey || evt.ctrlKey || this.e)) {
|
||||
evt.preventDefault();
|
||||
|
||||
const key = this.mapKeyEvent(evt);
|
||||
|
@ -553,7 +551,7 @@ export default class KeyBoard {
|
|||
}
|
||||
|
||||
private keyup = (evt: KeyboardEvent) => {
|
||||
if (!this.focused) {
|
||||
if (!this.dialogOpen()) {
|
||||
this.io.keyUp();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user