refactor: centralize file handling, fix zoom display and cleanup
File handling (document/file.rs): - move file operations from app/mod.rs to document/file.rs - add open_file_dialog() for native file picker - add collect_directory_siblings() for navigation context - add open_document_from_path() as main entry point Zoom/View (panels.rs, canvas.rs, model.rs): - fix zoom display using ViewMode enum - ViewMode::Fit shows Fit, ActualSize shows 100%, Custom shows percentage Model/Update cleanup: - adjust model.rs for new file handling - update.rs: use centralized file functions - document/mod.rs: re-exports for file module i18n: BB ctua.ftl with new/changed strings" A - update noctua.ftl with new/changed strings"
This commit is contained in:
parent
4de63d8549
commit
4c10a80b67
8 changed files with 212 additions and 259 deletions
|
|
@ -7,9 +7,9 @@ use cosmic::iced::{Alignment, Length};
|
|||
use cosmic::widget::{container, image, text, Column, Row};
|
||||
use cosmic::Element;
|
||||
|
||||
use crate::fl;
|
||||
use crate::app::model::ViewMode;
|
||||
use crate::app::{AppMessage, AppModel};
|
||||
use crate::fl;
|
||||
|
||||
/// Render the center canvas area with the current document.
|
||||
pub fn view(model: &AppModel) -> Element<'_, AppMessage> {
|
||||
|
|
@ -30,11 +30,11 @@ pub fn view(model: &AppModel) -> Element<'_, AppMessage> {
|
|||
.width(Length::Fixed(native_w as f32))
|
||||
.height(Length::Fixed(native_h as f32))
|
||||
}
|
||||
ViewMode::Custom(_) => {
|
||||
ViewMode::Custom(zoom) => {
|
||||
// Custom zoom factor applied to native size.
|
||||
let (native_w, native_h) = doc.dimensions();
|
||||
let scaled_w = (native_w as f32 * model.zoom).round();
|
||||
let scaled_h = (native_h as f32 * model.zoom).round();
|
||||
let scaled_w = (native_w as f32 * zoom).round();
|
||||
let scaled_h = (native_h as f32 * zoom).round();
|
||||
image::Image::new(handle)
|
||||
.width(Length::Fixed(scaled_w))
|
||||
.height(Length::Fixed(scaled_h))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue