diff --git a/crates/rnote-engine/src/engine/mod.rs b/crates/rnote-engine/src/engine/mod.rs index 2e7ad19093..42763fdd25 100644 --- a/crates/rnote-engine/src/engine/mod.rs +++ b/crates/rnote-engine/src/engine/mod.rs @@ -850,7 +850,10 @@ impl Engine { } pub fn duplicate_selection(&mut self) -> WidgetFlags { - let new_selected = self.store.duplicate_selection(); + let new_selected = self.store.duplicate_selection( + self.document.background.pattern_size, + self.document.snap_positions, + ); self.store.update_geometry_for_strokes(&new_selected); self.current_pen_update_state() | self.doc_resize_autoexpand() diff --git a/crates/rnote-engine/src/pens/selector/penevents.rs b/crates/rnote-engine/src/pens/selector/penevents.rs index fe0597a84e..a993e561d0 100644 --- a/crates/rnote-engine/src/pens/selector/penevents.rs +++ b/crates/rnote-engine/src/pens/selector/penevents.rs @@ -628,7 +628,10 @@ impl Selector { KeyboardKey::Unicode('d') => { //Duplicate selection if modifier_keys.contains(&ModifierKey::KeyboardCtrl) { - let duplicated = engine_view.store.duplicate_selection(); + let duplicated = engine_view.store.duplicate_selection( + engine_view.document.background.pattern_size, + engine_view.document.snap_positions, + ); engine_view.store.update_geometry_for_strokes(&duplicated); engine_view.store.regenerate_rendering_for_strokes_threaded( engine_view.tasks_tx.clone(), diff --git a/crates/rnote-engine/src/store/selection_comp.rs b/crates/rnote-engine/src/store/selection_comp.rs index f390dbe57f..f177101325 100644 --- a/crates/rnote-engine/src/store/selection_comp.rs +++ b/crates/rnote-engine/src/store/selection_comp.rs @@ -95,7 +95,11 @@ impl StrokeStore { /// Duplicate the selected keys. /// /// The returned, duplicated strokes then need to update their geometry and rendering. - pub(crate) fn duplicate_selection(&mut self) -> Vec { + pub(crate) fn duplicate_selection( + &mut self, + pattern_size: na::Vector2, + snap_mode: bool, + ) -> Vec { let old_selected = self.selection_keys_as_rendered(); self.set_selected_keys(&old_selected, false); @@ -126,8 +130,14 @@ impl StrokeStore { .collect::>(); // Offsetting the new selected stroke to make the duplication apparent - self.translate_strokes(&new_selected, Stroke::IMPORT_OFFSET_DEFAULT); - self.translate_strokes_images(&new_selected, Stroke::IMPORT_OFFSET_DEFAULT); + // check if snap position is activated or not here + let offset = if snap_mode { + pattern_size + } else { + Stroke::IMPORT_OFFSET_DEFAULT + }; + self.translate_strokes(&new_selected, offset); + self.translate_strokes_images(&new_selected, offset); new_selected } diff --git a/crates/rnote-ui/src/appwindow/actions.rs b/crates/rnote-ui/src/appwindow/actions.rs index 500a05ac7f..d0d728b2b6 100644 --- a/crates/rnote-ui/src/appwindow/actions.rs +++ b/crates/rnote-ui/src/appwindow/actions.rs @@ -722,6 +722,7 @@ impl RnAppWindow { let new_zoom = canvas.engine_ref().camera.total_zoom() * (1.0 - RnCanvas::ZOOM_SCROLL_STEP); let mut widget_flags = canvas.engine_mut().zoom_w_timeout(new_zoom); + canvas.engine_ref().camera.total_zoom() * (1.0/(1.0 + RnCanvas::ZOOM_SCROLL_STEP)); widget_flags |= canvas .engine_mut() .camera @@ -1125,20 +1126,21 @@ impl RnAppWindow { app.set_accels_for_action("win.print-doc", &["p"]); app.set_accels_for_action("win.add-page-to-doc", &["a"]); app.set_accels_for_action("win.remove-page-from-doc", &["r"]); - app.set_accels_for_action("win.zoom-in", &["plus"]); - app.set_accels_for_action("win.zoom-out", &["minus"]); + app.set_accels_for_action("win.zoom-in", &["plus","equal","KP_Add"]); + app.set_accels_for_action("win.zoom-reset",&["0","KP_0"]); + app.set_accels_for_action("win.zoom-out", &["minus","KP_Subtract"]); app.set_accels_for_action("win.import-file", &["i"]); app.set_accels_for_action("win.undo", &["z"]); app.set_accels_for_action("win.redo", &["z"]); app.set_accels_for_action("win.clipboard-copy", &["c"]); app.set_accels_for_action("win.clipboard-cut", &["x"]); app.set_accels_for_action("win.clipboard-paste", &["v"]); - app.set_accels_for_action("win.pen-style::brush", &["1"]); - app.set_accels_for_action("win.pen-style::shaper", &["2"]); - app.set_accels_for_action("win.pen-style::typewriter", &["3"]); - app.set_accels_for_action("win.pen-style::eraser", &["4"]); - app.set_accels_for_action("win.pen-style::selector", &["5"]); - app.set_accels_for_action("win.pen-style::tools", &["6"]); + app.set_accels_for_action("win.pen-style::brush", &["1","KP_1"]); + app.set_accels_for_action("win.pen-style::shaper", &["2","KP_2"]); + app.set_accels_for_action("win.pen-style::typewriter", &["3","KP_3"]); + app.set_accels_for_action("win.pen-style::eraser", &["4","KP_4"]); + app.set_accels_for_action("win.pen-style::selector", &["5","KP_5"]); + app.set_accels_for_action("win.pen-style::tools", &["6","KP_6"]); // shortcuts for devel build if config::PROFILE.to_lowercase().as_str() == "devel" {