Skip to content

image::Viewer widget always clipping the bottom and right sides when the zoomed image exceeds the container #3103

@stevekki

Description

@stevekki

Is your issue REALLY a bug?

  • My issue is indeed a bug!
  • I am not crazy! I will not fill out this form just to ask a question or request a feature. Pinky promise.

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

When using the Viewer widget, the image is always cropped at the bottom and right edges once it exceeds the container after zooming.

Screencast_1.webm

example:

use iced::widget::{
    center,
    image::{Handle, viewer},
};

pub fn main() -> iced::Result {
    iced::application(App::new, App::update, App::view).run()
}

#[derive(Debug, Clone)]
enum Message {}

struct App {
    handle: Handle,
}

impl App {
    fn new() -> Self {
        Self {
            handle: Handle::from_path("ferris.png"),
        }
    }

    fn update(&mut self, _: Message) {}

    fn view(&self) -> iced::Element<'_, Message> {
        center(viewer(self.handle.clone())).into()
    }
}

What is the expected behavior?

When the zoomed image exceeds the container, it should not be cropped at the bottom or right edges.

Screencast_2.webm

Version

master

Operating System

Linux

Do you have any log output?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions