Add clear artboards button to undo history (#1643)

This commit is contained in:
Haikal 2024-03-02 23:39:41 +07:00 committed by Keavon Chambers
parent f02dd5c0f6
commit 128f76af7e
3 changed files with 6 additions and 1 deletions

View File

@ -42,6 +42,7 @@ pub enum DocumentMessage {
BackupDocument {
network: NodeNetwork,
},
ClearArtboards,
ClearLayersPanel,
CommitTransaction,
CreateEmptyFolder {

View File

@ -346,6 +346,10 @@ impl MessageHandler<DocumentMessage, DocumentInputs<'_>> for DocumentMessageHand
}
}
BackupDocument { network } => self.backup_with_document(network, responses),
ClearArtboards => {
self.backup(responses);
responses.add(GraphOperationMessage::ClearArtboards);
}
ClearLayersPanel => {
// Send an empty layer list
let data_buffer: RawBuffer = Self::default().serialize_root();

View File

@ -254,7 +254,7 @@ impl LayoutHolder for MenuBarMessageHandler {
no_active_document,
MenuBarEntryChildren(vec![vec![MenuBarEntry {
label: "Clear Artboards".into(),
action: MenuBarEntry::create_action(|_| GraphOperationMessage::ClearArtboards.into()),
action: MenuBarEntry::create_action(|_| DocumentMessage::ClearArtboards.into()),
disabled: no_active_document,
..MenuBarEntry::default()
}]]),