feat: implement crop functionality with self-contained widget

- Inspired by cosmic-viewer's crop implementation (https://codeberg.org/bhh32/cosmic-viewer)
- Add crop support for all document types (Raster, Vector, Portable)
This commit is contained in:
wfx 2026-01-22 20:40:36 +01:00
parent 9399a008c4
commit 3cf99ad19d
20 changed files with 1042 additions and 103 deletions

View file

@ -6,6 +6,7 @@
use std::path::PathBuf;
use crate::app::ContextPage;
use crate::app::view::crop::DragHandle;
#[derive(Debug, Clone)]
pub enum AppMessage {
@ -45,6 +46,21 @@ pub enum AppMessage {
ToggleCropMode,
ToggleScaleMode,
// Crop operations.
StartCrop,
CancelCrop,
ApplyCrop,
CropDragStart {
x: f32,
y: f32,
handle: DragHandle,
},
CropDragMove {
x: f32,
y: f32,
},
CropDragEnd,
// Panels.
ToggleContextPage(ContextPage),
ToggleNavBar,
@ -53,6 +69,9 @@ pub enum AppMessage {
#[allow(dead_code)]
RefreshMetadata,
// Save operations.
SaveAs,
// Wallpaper.
SetAsWallpaper,