View Issue Details

IDProjectCategoryView StatusLast Update
0017529ScribusGeneralpublic2025-05-23 05:05
Reporterale Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Product Version1.7.1.svn 
Summary0017529: [PATCH] Accept negative values for the rotation in the properties palette
DescriptionEntering negative values, will "automatically" subtract them from 360.

I don't see any reason for not allowing the simple calculation "-45" to get "315".
TagsNo tags attached.
PatchYes

Relationships

related to 0017528 new Object rotation input field is is backwards 

Activities

ale

2025-05-19 19:15

manager   ~0052624

If the patch is OK, then it would be worth to apply the same change to the other rotation fields in Scribus (grep for "rotationSpin" to get a nice list).

jghali

2025-05-21 20:45

administrator   ~0052634

Patch, where are thu ?

jghali

2025-05-21 20:56

administrator   ~0052635

It seems doing this should not be too hard. It is possible to get negative values converted to positive values if we add these lines at the end of ScrSpinBox::valueFromText() :

if (m_unitIndex == SC_DEGREES)
{
    while (erg < minimum())
        erg += 360;
    while (erg > maximum())
        erg -= 360;
}

By doing this, all spinboxes using degrees as unit will also start accepting negative values.

ale

2025-05-22 05:47

manager   ~0052636

ooops
rotation-negative.diff (558 bytes)   
diff --git a/scribus/ui/propertiespalette_xyz.cpp b/scribus/ui/propertiespalette_xyz.cpp
index 5ad7a7747..8e4442048 100644
--- a/scribus/ui/propertiespalette_xyz.cpp
+++ b/scribus/ui/propertiespalette_xyz.cpp
@@ -142,7 +142,7 @@ void PropertiesPalette_XYZ::setDoc(ScribusDoc *d)
 	heightSpin->setValues( m_unitRatio, maxXYWHVal, precision, m_unitRatio);
 	heightSpin->setConstants(docConstants);
 
-	rotationSpin->setValues( 0, 359.99, 1, 0);
+	rotationSpin->setValues( -360, 360, 1, 0);
 	basePointWidget->setAngle(0);
 
 	updateSpinBoxConstants();
rotation-negative.diff (558 bytes)   

ale

2025-05-22 05:56

manager   ~0052638

of course, if the patch you're proposing does the job, just go for it!

ale

2025-05-22 06:07

manager   ~0052639

just did a quick test: adding your line at the very end of ScrSpinBox::valueFromText() has no effect in the rotation field in the PP.

with negative values, i always get 0° (probably related to the min and max value i'm fixing the patch i'm proposing).

on the other side, by "relaxing" the boundaries, i seem to automatically get the expected value.
i did not test every possible use case, but the few tests i did were well behaved.

jghali

2025-05-22 06:35

administrator   ~0052641

Not sure where you added the lines, but the only way they could have no effect in the rotation field of the PP is if they are added after the return ;)

ale

2025-05-22 08:51

manager   ~0052642

no oooops this time...

it was just before the return : -- )

probably, not the right place.

i've now also tried to put it at a different place also without visible effect.

i'll let you play with it and choose the right approach.

as written above, if the patch i'm proposing is accepted, i can then go through the other places where one can set the rotation.

jghali

2025-05-22 22:22

administrator   ~0052644

When rotation is set to PageItem, it is automatically fixed up in PageItem::setRotation to a positive value. So at this point rotation value cannot stay negative quite long in PP anyway. We need to do a code review to check if negative rotation values can be stored safely. If we allow 1.7.1+ file format to store negative values, we'll have to make sure old file formats continue to save positive rotation values anyway.

ale

2025-05-23 05:05

manager   ~0052645

The patch above converts the values to positive values.

I'm fine with that.

Being able to display and store negative values is for sure even better.

Issue History

Date Modified Username Field Change
2025-05-19 19:13 ale New Issue
2025-05-19 19:13 ale Patch No => Yes
2025-05-19 19:15 ale Note Added: 0052624
2025-05-21 20:45 jghali Note Added: 0052634
2025-05-21 20:56 jghali Note Added: 0052635
2025-05-22 05:47 ale Note Added: 0052636
2025-05-22 05:47 ale File Added: rotation-negative.diff
2025-05-22 05:48 ale Relationship added related to 0017528
2025-05-22 05:56 ale Note Added: 0052638
2025-05-22 06:07 ale Note Added: 0052639
2025-05-22 06:35 jghali Note Added: 0052641
2025-05-22 08:51 ale Note Added: 0052642
2025-05-22 22:22 jghali Note Added: 0052644
2025-05-23 05:05 ale Note Added: 0052645