mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-17 00:13:17 +00:00
fix overflow canvas
This commit is contained in:
@@ -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,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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user