Skip to content

Commit

Permalink
Merge pull request #226 from irfanabliz/shortcuts-add-new-paper-note
Browse files Browse the repository at this point in the history
shortcuts - add new paper note
  • Loading branch information
Dimchikkk committed Sep 11, 2023
2 parents b76fedf + f71c79f commit b75fa7c
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/ui_plugin/systems/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::{
resources::{LoadTabRequest, SaveTabRequest},
themes::Theme,
utils::{bevy_color_to_cosmic, ReflectableUuid},
AddRect, UiState,
AddRect, JsonNode, JsonNodeText, NodeType, UiState,
};

use super::ui_helpers::{Drawing, EditableText, InteractiveNode};
Expand Down Expand Up @@ -124,6 +124,24 @@ pub fn keyboard_input_system(
});
}
}
} else if command && input.just_pressed(KeyCode::P) {
events.send(AddRect {
node: JsonNode {
id: Uuid::new_v4(),
node_type: NodeType::Paper,
x,
y,
width: theme.node_width,
height: theme.node_height,
text: JsonNodeText {
text: "".to_string(),
pos: crate::TextPos::Center,
},
bg_color: pair_struct!(theme.paper_node_bg),
..Default::default()
},
image: None,
});
} else {
for (editable_text, mut cosmic_edit, mut cosmit_edit_history) in
&mut editable_text_query.iter_mut()
Expand Down Expand Up @@ -182,8 +200,6 @@ pub fn insert_from_clipboard(
scale_factor: f64,
theme: &Res<Theme>,
) {
use crate::JsonNode;

if let Ok(mut clipboard) = arboard::Clipboard::new() {
if let Ok(image) = clipboard.get_image() {
let image: RgbaImage = ImageBuffer::from_raw(
Expand Down

0 comments on commit b75fa7c

Please sign in to comment.