mirror of https://github.com/GNOME/gimp.git
app: use some canvas item highlighting in GimpCageTool
and don't draw two handles on top of each other for selected points.
This commit is contained in:
parent
f73b7f986b
commit
8f6c0fd17c
|
@ -44,6 +44,7 @@
|
|||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "display/gimpcanvasitem.h"
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "gimpcagetool.h"
|
||||
|
@ -822,6 +823,7 @@ gimp_cage_tool_draw (GimpDrawTool *draw_tool)
|
|||
/* Draw the cage with handles. */
|
||||
for (i = 0; i < n_vertices; i++)
|
||||
{
|
||||
GimpCanvasItem *item;
|
||||
GimpVector2 point1, point2;
|
||||
|
||||
point1 = gimp_cage_config_get_point_coordinate (ct->config,
|
||||
|
@ -845,23 +847,45 @@ gimp_cage_tool_draw (GimpDrawTool *draw_tool)
|
|||
point2.x += ct->offset_x;
|
||||
point2.y += ct->offset_y;
|
||||
|
||||
if (i != ct->hovering_edge ||
|
||||
gimp_cage_tool_is_complete (ct))
|
||||
{
|
||||
gimp_draw_tool_push_group (draw_tool, stroke_group);
|
||||
}
|
||||
|
||||
gimp_draw_tool_add_line (draw_tool,
|
||||
item = gimp_draw_tool_add_line (draw_tool,
|
||||
point1.x,
|
||||
point1.y,
|
||||
point2.x,
|
||||
point2.y);
|
||||
|
||||
if (i == ct->hovering_edge &&
|
||||
! gimp_cage_tool_is_complete (ct))
|
||||
{
|
||||
gimp_canvas_item_set_highlight (item, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_draw_tool_pop_group (draw_tool);
|
||||
}
|
||||
}
|
||||
|
||||
if (gimp_cage_config_point_is_selected (ct->config, i))
|
||||
{
|
||||
if (i == ct->hovering_handle)
|
||||
handle = GIMP_HANDLE_FILLED_SQUARE;
|
||||
else
|
||||
handle = GIMP_HANDLE_SQUARE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i == ct->hovering_handle)
|
||||
handle = GIMP_HANDLE_FILLED_CIRCLE;
|
||||
else
|
||||
handle = GIMP_HANDLE_CIRCLE;
|
||||
}
|
||||
|
||||
gimp_draw_tool_add_handle (draw_tool,
|
||||
item = gimp_draw_tool_add_handle (draw_tool,
|
||||
handle,
|
||||
point1.x,
|
||||
point1.y,
|
||||
|
@ -869,16 +893,8 @@ gimp_cage_tool_draw (GimpDrawTool *draw_tool)
|
|||
GIMP_TOOL_HANDLE_SIZE_CIRCLE,
|
||||
GIMP_HANDLE_ANCHOR_CENTER);
|
||||
|
||||
if (gimp_cage_config_point_is_selected (ct->config, i))
|
||||
{
|
||||
gimp_draw_tool_add_handle (draw_tool,
|
||||
GIMP_HANDLE_SQUARE,
|
||||
point1.x,
|
||||
point1.y,
|
||||
GIMP_TOOL_HANDLE_SIZE_CIRCLE,
|
||||
GIMP_TOOL_HANDLE_SIZE_CIRCLE,
|
||||
GIMP_HANDLE_ANCHOR_CENTER);
|
||||
}
|
||||
if (i == ct->hovering_handle)
|
||||
gimp_canvas_item_set_highlight (item, TRUE);
|
||||
}
|
||||
|
||||
if (ct->tool_state == DEFORM_STATE_SELECTING ||
|
||||
|
|
Loading…
Reference in New Issue