🎉 Improve frame rendering

This commit is contained in:
AzazelN28 2024-11-20 13:49:45 +01:00
parent 59fdf64c66
commit 2db1740ce8
6 changed files with 59 additions and 31 deletions

View file

@ -3,6 +3,7 @@ use uuid::Uuid;
use crate::render::RenderState;
use crate::shapes::Shape;
use crate::view::View;
/// This struct holds the state of the Rust application between JS calls.
///
@ -14,6 +15,7 @@ pub(crate) struct State<'a> {
pub current_id: Option<Uuid>,
pub current_shape: Option<&'a mut Shape>,
pub shapes: HashMap<Uuid, Shape>,
pub view: View,
}
impl<'a> State<'a> {
@ -23,6 +25,11 @@ impl<'a> State<'a> {
current_id: None,
current_shape: None,
shapes: HashMap::with_capacity(capacity),
view: View {
x: 0.,
y: 0.,
zoom: 1.,
}
}
}