Delete selected layers (#173)

* Delete Layers
* Fix backend selection
* Fix shift selection
* Add desired shape add selection behavior
* Add X and Backspace as keybinds for layer deletion
* Change key storage to u128
* Remove unhelpful trace logging
* Reverse display direction for layers
This commit is contained in:
TrueDoctor
2021-06-10 09:24:59 +02:00
committed by GitHub
parent 981f138812
commit 0e488d99ff
10 changed files with 81 additions and 28 deletions

View File

@@ -147,6 +147,9 @@ impl Default for Mapping {
entry! {action=PenMessage::Confirm, key_down=KeyEnter},
// Document Actions
entry! {action=DocumentMessage::Undo, key_down=KeyZ, modifiers=[KeyControl]},
entry! {action=DocumentMessage::DeleteSelectedLayers, key_down=KeyDelete},
entry! {action=DocumentMessage::DeleteSelectedLayers, key_down=KeyX},
entry! {action=DocumentMessage::DeleteSelectedLayers, key_down=KeyBackspace},
entry! {action=DocumentMessage::ExportDocument, key_down=KeyS, modifiers=[KeyControl, KeyShift]},
entry! {action=DocumentMessage::ExportDocument, key_down=KeyE, modifiers=[KeyControl]},
// Tool Actions

View File

@@ -1,7 +1,7 @@
pub const NUMBER_OF_KEYS: usize = Key::NumKeys as usize;
// Edit this to specify the storage type used
// TODO: Increase size of type
pub type StorageType = u8;
pub type StorageType = u128;
const STORAGE_SIZE: u32 = std::mem::size_of::<usize>() as u32 * 8 + 2 - std::mem::size_of::<StorageType>().leading_zeros();
const STORAGE_SIZE_BITS: usize = 1 << STORAGE_SIZE;
const KEY_MASK_STORAGE_LENGTH: usize = (NUMBER_OF_KEYS + STORAGE_SIZE_BITS - 1) >> STORAGE_SIZE;
@@ -55,6 +55,8 @@ pub enum Key {
KeyEnter,
KeyShift,
KeyControl,
KeyDelete,
KeyBackspace,
KeyAlt,
KeyEscape,