app: commit the free selection before floating it.

When using a selection modifier Altr+Ctrl|Shift, we want to commit the
selection. If I do it too late though, and if the polygon was not closed
yet, the computed coordinates for the floating selection end up (0, 0)
because it is based on the selection coordinates (yet an unclosed
polygon does not create a selection yet). So commit the tool from within
GimpSelectionTool instead, as soon as we confirmed that the class is
going to take over with SELECTION_MOVE or SELECTION_MOVE_COPY.

Note: ability of quick copying|cuting an unclosed polygon is very useful
as it removes the additional step for a case where anyway committing the
selection was a prerequisite.
This commit is contained in:
Jehan 2019-06-16 20:23:10 +02:00
parent c9a91b32bc
commit 50f8cb8542
2 changed files with 4 additions and 5 deletions

View File

@ -181,11 +181,8 @@ gimp_free_select_tool_button_press (GimpTool *tool,
if (gimp_selection_tool_start_edit (GIMP_SELECTION_TOOL (poly_sel),
display, coords))
{
if (display)
gimp_tool_control (tool, GIMP_TOOL_ACTION_COMMIT, display);
return;
}
return;
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
press_type, display);

View File

@ -614,6 +614,8 @@ gimp_selection_tool_start_edit (GimpSelectionTool *sel_tool,
{
GimpTranslateMode edit_mode;
gimp_tool_control (tool, GIMP_TOOL_ACTION_COMMIT, display);
if (sel_tool->function == SELECTION_MOVE)
edit_mode = GIMP_TRANSLATE_MODE_MASK_TO_LAYER;
else