49 lines
704 B
Rust
49 lines
704 B
Rust
use super::block;
|
|
|
|
impl State
|
|
{
|
|
fn cur_block(&self) -> &block::Block
|
|
{
|
|
self.blocks.last().unwrap()
|
|
}
|
|
|
|
fn cur_block_mut(&mut self) -> &mut block::Block
|
|
{
|
|
self.blocks.last_mut().unwrap()
|
|
}
|
|
}
|
|
|
|
impl Default for State
|
|
{
|
|
#[inline]
|
|
fn default() -> Self
|
|
{
|
|
Self{blocks: vec![block::Block::default()],
|
|
tool: Tool::default()}
|
|
}
|
|
}
|
|
|
|
impl Default for Tool
|
|
{
|
|
#[inline]
|
|
fn default() -> Self {Tool::Points}
|
|
}
|
|
|
|
/// The state of an opened map editor.
|
|
pub struct State
|
|
{
|
|
pub(super) blocks: Vec<block::Block>,
|
|
pub(super) tool: Tool,
|
|
}
|
|
|
|
/// A tool in the map editor.
|
|
#[derive(Debug)]
|
|
pub(super) enum Tool
|
|
{
|
|
Points,
|
|
Lines,
|
|
Polygons,
|
|
}
|
|
|
|
// EOF
|