diff --git a/www.eng/js/porting/fps_counter.js b/www.eng/js/porting/fps_counter.js index 60b2523..073c285 100644 --- a/www.eng/js/porting/fps_counter.js +++ b/www.eng/js/porting/fps_counter.js @@ -6,23 +6,11 @@ function create_fps_button() { FPSBtn.id = "buttonF2"; document.body.appendChild(FPSBtn); - console.log(`Setting up the FPS key...`); - FPSBtn.addEventListener("pointerdown", (event) => { - console.log(`Pointer down for F2`); event.stopImmediatePropagation(); event.preventDefault(); - sendEvent(false, 113); + Graphics._switchFPSMeter(); }); - - FPSBtn.addEventListener("pointerup", () => { - sendEvent(true, 113); - }); -} - -function sendEvent(isUp, keycode) { - document.getElementById("GameCanvas").focus(); - document.dispatchEvent(new KeyboardEvent(isUp ? 'keyup' : 'keydown', { 'key': '', keyCode: keycode })) } window.addEventListener('load', () => { diff --git a/www.rus/js/porting/fps_counter.js b/www.rus/js/porting/fps_counter.js index 60b2523..073c285 100644 --- a/www.rus/js/porting/fps_counter.js +++ b/www.rus/js/porting/fps_counter.js @@ -6,23 +6,11 @@ function create_fps_button() { FPSBtn.id = "buttonF2"; document.body.appendChild(FPSBtn); - console.log(`Setting up the FPS key...`); - FPSBtn.addEventListener("pointerdown", (event) => { - console.log(`Pointer down for F2`); event.stopImmediatePropagation(); event.preventDefault(); - sendEvent(false, 113); + Graphics._switchFPSMeter(); }); - - FPSBtn.addEventListener("pointerup", () => { - sendEvent(true, 113); - }); -} - -function sendEvent(isUp, keycode) { - document.getElementById("GameCanvas").focus(); - document.dispatchEvent(new KeyboardEvent(isUp ? 'keyup' : 'keydown', { 'key': '', keyCode: keycode })) } window.addEventListener('load', () => {