image: Use convention that rotations is always CCW

This commit is contained in:
Sophie Herold 2025-02-22 00:23:28 +01:00
parent 2cfaf865c3
commit 341aef672e
10 changed files with 22 additions and 22 deletions

View file

@ -1,4 +1,4 @@
// Copyright (c) 2024 Sophie Herold
// Copyright (c) 2024-2025 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
@ -72,7 +72,7 @@ impl Queue {
let edit_instruction = editor.apply_sparse(operations).await?;
if edit_instruction.apply_to(file).await? == EditOutcome::Unchanged {
log::error!("Writing new files is not supported yet");
log::warn!("Writing new files is not supported yet");
}
Ok(())

View file

@ -176,9 +176,9 @@ mod imp {
pub(super) decoder: RefCell<Option<Arc<Decoder>>>,
pub(super) overwrite_dimensions: Cell<Option<(u32, u32)>>,
/// Rotation final value (can differ from `rotation` during animation)
/// Rotation CCW final value (can differ from `rotation` during animation)
pub(super) rotation_target: Cell<f64>,
/// Rotated presentation of original image in degrees clockwise
/// Rotated CCW presentation of original image in degrees clockwise
#[property(get, set = Self::set_rotation, explicit_notify)]
pub(super) rotation: Cell<f64>,
// Animates the `rotation` property

View file

@ -239,7 +239,7 @@ impl imp::LpImage {
#[weak]
obj,
move |gesture, _, _| {
let angle = gesture.angle_delta().to_degrees();
let angle = -gesture.angle_delta().to_degrees();
// Only reset rotation if scale gesture is locked in
if let Some(Gesture::Scale) = obj.imp().locked_gestured.get() {

View file

@ -1,4 +1,4 @@
// Copyright (c) 2023-2024 Sophie Herold
// Copyright (c) 2023-2025 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
@ -249,7 +249,7 @@ impl imp::LpImage {
));
// Apply the transformations from properties
snapshot.rotate(rotation);
snapshot.rotate(-rotation);
if mirrored {
snapshot.scale(-1., 1.);
}

View file

@ -1,4 +1,4 @@
// Copyright (c) 2023-2024 Sophie Herold
// Copyright (c) 2023-2025 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
@ -78,9 +78,9 @@ impl LpImage {
let orientation = self.metadata().orientation();
self.imp()
.rotation_target
.set(-(orientation.rotate().degrees() as f64));
.set(orientation.rotate().degrees() as f64);
self.set_mirrored(orientation.mirror());
self.set_rotation(-(orientation.rotate().degrees() as f64));
self.set_rotation(orientation.rotate().degrees() as f64);
}
pub fn rotate_by(&self, angle: f64) {

View file

@ -1,4 +1,4 @@
// Copyright (c) 2022-2024 Sophie Herold
// Copyright (c) 2022-2025 Sophie Herold
// Copyright (c) 2022, 2024 Christopher Davis
//
// This program is free software: you can redistribute it and/or modify

View file

@ -1,4 +1,4 @@
// Copyright (c) 2024 Sophie Herold
// Copyright (c) 2024-2025 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
@ -154,13 +154,13 @@ impl Action {
// Rotation/Zoom
Action::RotateCw => {
klass.install_action(&action, None, |win, _, _| {
win.rotate_image(90.0);
win.rotate_image(-90.0);
});
}
Action::RotateCcw => {
klass.install_action(&action, None, |win, _, _| {
win.rotate_image(-90.0);
win.rotate_image(90.0);
});
}