"Swap fill and stroke" doesn't work for multiple objects

Bug #367360 reported by Krzysztof Kosinski
6
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
Alexandru Roman

Bug Description

When right-clicking on the selected style swatch, there's an action called "swap fill and stroke". However, it works incorrectly when more than one object is selected: instead of swapping the fill and stroke on each object, it averages the fills and strokes of all objects and then swaps them.

An example use case where this could be useful is for jittering the colors of strokes: the jitter color tool works on fills only.

Tags: color
Revision history for this message
Krzysztof Kosinski (tweenk) wrote :

Confirming and assigning Bulia as requested in e-mail.

Changed in inkscape:
assignee: nobody → buliabyak
status: New → Confirmed
jazzynico (jazzynico)
Changed in inkscape:
importance: Undecided → Low
tags: added: color
Revision history for this message
Beluga (buovjaga) wrote :

Still repro.

Arch Linux 64-bit, KDE Plasma 5
Inkscape 0.92pre1 15054 (GTK3)

Revision history for this message
Alexandru Roman (alexandru.roman) wrote :

I think the problem is not with the already implemented function for swap fill and stroke because it is acting as it meant to be: swaping the 2 colors from the swatch. And, if multiple objects are selected, the colors from the swatch will be the avarage color of the objects.
I looked up into the code in order to find something to change to adapt the function working with multiple objects but I realised it is acting properly for his purpose.

So I made my own function based on the ObjectSet data structure. I also added a verb definition for a shortcut.

I attached the solution.

Mc (mc...)
Changed in inkscape:
assignee: bbyak (buliabyak) → Alexandru Roman (alexandru.roman)
Revision history for this message
Alexandru Roman (alexandru.roman) wrote :

I made up some changes to the patch:
Removed the old swap function from src/ui/widget/selection-style.cpp as well the UI button for that function because the new one works for multiple objets.
Improved the new function with undo capability.

Revision history for this message
Alexandru Roman (alexandru.roman) wrote :

Another change to last version:
Keeps the UI button's functionality for "swap fill and stroke" but adapts it with the new function.

Revision history for this message
Mc (mc...) wrote :

Fix pushed to trunk r15428

Thanks !

Changed in inkscape:
milestone: none → 0.93
status: Confirmed → Fix Committed
Revision history for this message
Hachmann (marenhachmann) wrote :

Could you document the change here, @Alexandru Roman - so users will be able to know about them: http://wiki.inkscape.org/wiki/index.php/Release_notes/0.93 ?

(see http://wiki.inkscape.org/wiki/index.php/Release_notes/0.92 for previous version to compare).

Revision history for this message
Alexandru Roman (alexandru.roman) wrote :

Sure, I'll do my best!

Revision history for this message
Alexandru Roman (alexandru.roman) wrote :

I don't have permission to edit that page. I should post here the edited source of the page?

Revision history for this message
Hachmann (marenhachmann) wrote :

No, we can give you access. Which user name would you like?

Revision history for this message
Alexandru Roman (alexandru.roman) wrote :

alexandru.roman

Revision history for this message
Hachmann (marenhachmann) wrote :

I just noticed I don't have an email address to go with the user name...

I will set a preliminary password, and send it to you via launchpad message. Please change the password after login and add an email address.

Revision history for this message
Hachmann (marenhachmann) wrote :

Sent, please test if it worked.

Max Gaukler (mgmax)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.