refactor: improve code quality and consistency
Comprehensive code audit addressing naming consistency, dead code removal, and documentation improvements across the entire codebase. - Rename panel_pages.rs → pages_panel.rs for consistent naming - Unify view functions: all panels now use view() convention - Rename header_start/end() → start/end() for brevity - Update all imports and references - Remove Rotation::from_degrees() (only 4 fixed states needed) - Remove TransformState::identity() and is_identity() (Default suffices) - Remove duplicate convenience methods from RasterDocument, VectorDocument, PortableDocument (rotate_cw/ccw, flip_horizontal/vertical) - Remove unused imports and constants (ROTATION_STEP, FULL_ROTATION) - Rename constants: PDF_RENDER_SCALE → PDF_RENDER_QUALITY, PDF_THUMBNAIL_SCALE → PDF_THUMBNAIL_SIZE - Add comprehensive trait documentation explaining type erasure pattern - Document why large enum variants are acceptable - Add #[allow(dead_code)] with explanations for trait API types - Improve all constant and config comments - Collapse nested if statements using Rust 2024 let-chains - Replace single-arm match with if-let - Introduce StateChangeCallback<Message> type alias - Apply clippy auto-fixes for better code style
This commit is contained in:
parent
0e31b146a3
commit
9399a008c4
19 changed files with 744 additions and 418 deletions
|
|
@ -3,19 +3,13 @@
|
|||
//
|
||||
// Application constants that should not be changed by the user.
|
||||
|
||||
/// Rotation step in degrees (90 = quarter turn).
|
||||
pub const ROTATION_STEP: i16 = 90;
|
||||
|
||||
/// Full rotation in degrees (for modulo calculation in angle normalization).
|
||||
pub const FULL_ROTATION: i16 = 360;
|
||||
|
||||
/// Minutes per degree (GPS coordinate conversion: DMS to decimal degrees).
|
||||
pub const MINUTES_PER_DEGREE: f64 = 60.0;
|
||||
|
||||
/// Seconds per degree (GPS coordinate conversion: DMS to decimal degrees).
|
||||
pub const SECONDS_PER_DEGREE: f64 = 3600.0;
|
||||
|
||||
/// Minimum pixmap size for SVG rendering (prevents 0x0 images).
|
||||
/// Minimum pixmap size for SVG rendering (prevents zero-size pixmaps).
|
||||
pub const MIN_PIXMAP_SIZE: u32 = 1;
|
||||
|
||||
/// Tolerance for scale comparisons (float precision in zoom synchronization).
|
||||
|
|
@ -24,17 +18,17 @@ pub const SCALE_EPSILON: f32 = 0.0001;
|
|||
/// Tolerance for offset comparisons (float precision in pan synchronization).
|
||||
pub const OFFSET_EPSILON: f32 = 0.01;
|
||||
|
||||
/// Maximum thumbnail width in pixels (nav bar page thumbnails).
|
||||
/// Maximum width in pixels for page navigation thumbnails.
|
||||
pub const THUMBNAIL_MAX_WIDTH: f32 = 100.0;
|
||||
|
||||
/// Thumbnail cache directory name.
|
||||
/// Cache directory name under ~/.cache/ for thumbnail storage.
|
||||
pub const CACHE_DIR: &str = "noctua";
|
||||
|
||||
/// Thumbnail file extension.
|
||||
/// File extension for cached thumbnails.
|
||||
pub const THUMBNAIL_EXT: &str = "png";
|
||||
|
||||
/// Default render scale for PDF pages.
|
||||
pub const PDF_RENDER_SCALE: f64 = 2.0;
|
||||
/// PDF page render quality multiplier (2.0 = double resolution for sharp display).
|
||||
pub const PDF_RENDER_QUALITY: f64 = 2.0;
|
||||
|
||||
/// Thumbnail render scale (smaller for quick rendering).
|
||||
pub const PDF_THUMBNAIL_SCALE: f64 = 0.25;
|
||||
/// PDF thumbnail size multiplier (0.25 = 25% for fast preview generation).
|
||||
pub const PDF_THUMBNAIL_SIZE: f64 = 0.25;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue