diff --git a/src/shared/image_viewer.rs b/src/shared/image_viewer.rs index e9fc7f13..5cb0a7b7 100644 --- a/src/shared/image_viewer.rs +++ b/src/shared/image_viewer.rs @@ -16,6 +16,7 @@ use matrix_sdk_ui::timeline::EventTimelineItem; use thiserror::Error; use crate::shared::{avatar::AvatarWidgetExt, timestamp::TimestampWidgetRefExt}; +const SHOW_UI_DURATION: f64 = 2.0; /// Loads the given image `data` into an `ImageBuffer` as either a PNG or JPEG, using the `imghdr` library to determine which format it is. /// /// Returns an error if either load fails or if the image format is unknown. @@ -41,8 +42,6 @@ pub fn get_png_or_jpg_image_buffer(data: Vec) -> Result Self { Self { min_zoom: 0.5, - max_zoom: 4.0, zoom_scale_factor: 1.2, pan_sensitivity: 2.0, } @@ -111,6 +109,9 @@ live_design! { use crate::shared::avatar::Avatar; use crate::shared::timestamp::Timestamp; + UI_ANIMATION_DURATION_SECS = 0.2 + ROTATION_ANIMATION_DURATION_SECS = 0.2 + pub MagnifyingGlass = { width: Fit, height: Fit flow: Overlay @@ -118,11 +119,12 @@ live_design! { magnifying_glass_button = { width: Fit, height: Fit, + align: {x: 1.0, y: 0.0}, spacing: 0, - margin: 8, - padding: 3 + margin: {top: 4.5} // vertically align with the title + padding: 7, // Ensure the height is the same as the Close button. Height of Close button is 15 * 2 + 14 = 44. draw_bg: { - color: (COLOR_PRIMARY) + color: (COLOR_SECONDARY) } draw_icon: { svg_file: (ICON_ZOOM), @@ -147,12 +149,14 @@ live_design! { } } pub RotationButton = { - width: Fit, height: Fit, - margin: 8, - padding: 3 - align: {x: 0.5, y: 0.5} + width: Fit, + height: Fit, + align: {x: 1.0, y: 0.0}, + spacing: 0, + margin: {top: 4.5} // vertically align with the title + padding: 7, draw_bg: { - color: (COLOR_PRIMARY) + color: (COLOR_SECONDARY) } draw_icon: { svg_file: (ICON_ROTATE_CW), @@ -160,80 +164,25 @@ live_design! { return #x0; } } - icon_walk: {width: 30, height: 30, margin: {right: -10} } + icon_walk: {width: 30, height: 30, } } pub ImageViewer = {{ImageViewer}} { width: Fill, height: Fill, flow: Overlay show_bg: true draw_bg: { - color: (COLOR_PRIMARY) + color: (COLOR_IMAGE_VIEWER_BACKGROUND) } image_layer = { width: Fill, height: Fill, align: {x: 0.5, y: 0.5} - show_bg: true - draw_bg: { - color: (COLOR_PRIMARY) - } flow: Down - - header = { - width: Fill, height: 50 - flow: Right - align: {x: 1.0, y: 0.5}, - - zoom_button_minus = { - sign_label = { - width: Fill, height: Fill, - align: { x: 0.4, y: 0.35 } - - magnifying_glass_sign =