use crate::document::Document;
use crate::gpu::compositor::Compositor;
use crate::gpu::region_store::UndoRegionEntry;
use crate::layer::LayerId;
use std::collections::{HashMap, HashSet};
use super::UndoAction;
pub struct SelectionAction {
was_active: bool,
entry: UndoRegionEntry,
}
impl SelectionAction {
pub fn new(was_active: bool, entry: UndoRegionEntry) -> Self {
SelectionAction { was_active, entry }
}
}
impl UndoAction for SelectionAction {
fn undo(&mut self, _doc: &mut Document) -> HashMap<LayerId, HashSet<(i32, i32)>> {
HashMap::new()
}
fn redo(&mut self, _doc: &mut Document) -> HashMap<LayerId, HashSet<(i32, i32)>> {
HashMap::new()
}
fn selection_region_entry_mut(&mut self) -> Option<&mut UndoRegionEntry> {
Some(&mut self.entry)
}
fn swap_selection_active(&mut self, current_active: bool) -> Option<bool> {
let restore_to = self.was_active;
self.was_active = current_active;
Some(restore_to)
}
fn byte_cost(&self) -> u64 {
self.entry.byte_size
}
fn on_evict(&mut self, _compositor: &mut Compositor) {
}
}