File size: 684 Bytes
9982ad3 6fcc22e 9982ad3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
use crate::app::{DrawAction};
use std::collections::VecDeque;
pub struct Whiteboard {
actions: VecDeque<DrawAction>,
max_actions: usize,
}
impl Whiteboard {
pub fn new() -> Self {
Whiteboard {
actions: VecDeque::new(),
max_actions: 107000000000,
}
}
pub fn add_action(&mut self, action: DrawAction) {
if self.actions.len() >= self.max_actions {
self.actions.pop_front();
}
self.actions.push_back(action);
}
pub fn clear(&mut self) {
self.actions.clear();
}
pub fn get_actions(&self) -> Vec<DrawAction> {
self.actions.iter().cloned().collect()
}
}
|