fix overflow canvas

This commit is contained in:
rewin
2024-04-02 20:20:16 +03:00
parent 84be5fc08e
commit 20ce43e705
2 changed files with 5 additions and 5 deletions
@@ -75,9 +75,10 @@ export class CanvasProviderElement
@on("keyup")
_pipeKeyboardEvents(event: KeyboardEvent): void {
if (event.repeat) return;
if (this.#canvas != null) {
// If we own the canvas, we're going to catch events emitting from the
// canvas and then repeat them, eventually causing a stack overflow
const canvas = document.getElementById(this.#canvasId);
if (canvas && event.target === canvas) {
// If this event originated from the Bevy canvas, repeating it will just
// cause an infinite feedback loop and a stack overflow
return;
}
+1 -2
View File
@@ -1,7 +1,7 @@
use std::f32::consts;
use bevy::{
prelude::*, render::camera::Viewport, window::{CursorGrabMode, PrimaryWindow}
prelude::*, window::{CursorGrabMode, PrimaryWindow}
};
use crate::{
@@ -12,7 +12,6 @@ use crate::{
NearlyZero, Velocity,
},
};
use crate::MainCamera;
pub struct CameraControllerPlugin;