edit: Scale cropping selection area with image

This commit is contained in:
Sophie Herold 2024-09-17 20:13:39 +02:00
parent 6867e0b13f
commit 5b184e6be9
8 changed files with 133 additions and 56 deletions

View file

@ -1,3 +1,20 @@
// Copyright (c) 2024 Sophie Herold
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// SPDX-License-Identifier: GPL-3.0-or-later
use std::cell::{Cell, OnceCell};
use adw::prelude::*;
@ -103,12 +120,11 @@ mod imp {
obj.child().allocate(width, height, baseline, None);
// TODO: Round wrong
self.selection.set_size(
image.image_rendering_x() as i32,
image.image_rendering_y() as i32,
image.image_displayed_width().round() as i32,
image.image_displayed_height().round() as i32,
image.image_rendering_width() as i32,
image.image_rendering_height() as i32,
);
}