feat: UI rewrite - TEA architecture, eliminate sync pattern
Complete UI layer refactoring to achieve Clean Architecture + TEA principles. Major Changes: - Eliminated sync.rs (76 LOC of manual synchronization) - Restructured AppModel: pure UI state only - Introduced AppMode enum (View, Crop, Transform, Fullscreen) - Added Viewport struct (scale, pan, canvas, cached_image_handle) - Added PanelState struct (left, right panels) - Removed all cached document data from UI layer - Views now access DocumentManager directly (no caching) - Update functions work on both model and manager directly Architecture: - TEA-compliant: Single source of truth, unidirectional flow - Clean separation: UI state vs Document state - No manual synchronization required Benefits: - Simplified codebase: -1,986 LOC net (-75.6%) - Better maintainability: Clear responsibilities - Type-safe state: Enums instead of flags - Performance: Cached rendering where needed Refactored Files: - src/ui/model.rs: Complete rewrite - src/ui/update.rs: Complete rewrite - src/ui/views/*: Updated to use new architecture - src/ui/views/meta_panel.rs: Extracted from panels.rs Testing: - All 24 unit tests passing - Compiles successfully (cargo check, cargo build) - 32 warnings (non-critical, future features) BREAKING CHANGES: None (internal refactoring only) Co-authored-by: Clean Architecture principles Co-authored-by: TEA (The Elm Architecture) pattern
This commit is contained in:
parent
5126b24cb2
commit
6002b37406
22 changed files with 640 additions and 2626 deletions
|
|
@ -7,6 +7,7 @@ use cosmic::widget::image::Handle as ImageHandle;
|
|||
|
||||
/// Represents a single page in a multi-page document.
|
||||
#[derive(Debug, Clone)]
|
||||
#[allow(dead_code)]
|
||||
pub struct Page {
|
||||
/// Page index (0-based).
|
||||
pub index: usize,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue