Bug 381344 - Ungrouping vector object uses wrong z-order
Summary: Ungrouping vector object uses wrong z-order
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layers/Vector (show other bugs)
Version: git master (please specify the git hash!)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-18 03:57 UTC by Scott Petrovic
Modified: 2018-02-09 11:18 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Petrovic 2017-06-18 03:57:27 UTC
I was playing around with git latest on my Ubuntu 16.10 box and the new vector library when I discovered this. This is the steps to reproduce:

1. Open the vector libraries and switch to the "Word Balloons" tag 
2. Drag the "Hip Balloon" object on the canvas to add it.
3. Select the word balloon object on the canvas
4. Right click it and select the Ungroup option

Expected result:
White bubble object would stay in front of the black shadow object

Actual results: 
The black shadow object is in front of the white bubble object.


Something must not be reading the group's z-sorting when the ungroup command is done.
Comment 1 Scott Petrovic 2017-06-18 04:31:46 UTC
Playing around a little more with it. It appears the vector objects in the word balloons might be stored differently. After I ungroup the objects in the word balloon, Krita will not let me bring the objects to the front or back to change the z-order.

If I just create a couple of vector squares in Krita itself, I can change the z-order as expected.
Comment 2 Halla Rempt 2017-06-18 10:05:18 UTC
Yes, I noticed the same thing. We should go through bugzilla and make a list of vector bugs for Dmitry to look into.
Comment 3 Dmitry Kazakov 2018-02-09 11:18:43 UTC
Git commit 84500c3873e47053772e4ce65e4251dd6f4ddc70 by Dmitry Kazakov.
Committed on 09/02/2018 at 11:18.
Pushed by dkazakov into branch 'master'.

Fix z-index on shape grouping/ungrouping

When grouping, the command should change z-index as little as possible.
If the new shape was above the group, it should be appended, if it was
below the group, it should be prepended.

The same should happen on ungrouping: the ungrouped shapes should be
added right above their previous parent.

This patch also rewrites TestShapeGroupCommand

M  +19   -0    libs/flake/KoShape.cpp
M  +5    -0    libs/flake/KoShape.h
M  +67   -88   libs/flake/commands/KoShapeGroupCommand.cpp
M  +5    -19   libs/flake/commands/KoShapeGroupCommand.h
D  +0    -51   libs/flake/commands/KoShapeGroupCommand_p.h
M  +25   -14   libs/flake/commands/KoShapeReorderCommand.cpp
M  +25   -1    libs/flake/commands/KoShapeReorderCommand.h
M  +81   -43   libs/flake/commands/KoShapeUngroupCommand.cpp
M  +13   -4    libs/flake/commands/KoShapeUngroupCommand.h
M  +2    -2    libs/flake/svg/SvgParser.cpp
M  +539  -160  libs/flake/tests/TestShapeGroupCommand.cpp
M  +11   -5    libs/flake/tests/TestShapeGroupCommand.h
M  +1    -1    libs/flake/tests/TestShapePainting.cpp
M  +2    -2    libs/flake/tests/TestSvgParser.cpp
M  +2    -2    libs/ui/tests/kis_shape_commands_test.cpp
M  +5    -1    plugins/tools/defaulttool/defaulttool/DefaultTool.cpp

https://commits.kde.org/krita/84500c3873e47053772e4ce65e4251dd6f4ddc70