From fcd4b41f198adbe870c71e820b51e7e9be69d549 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Mon, 31 Jul 2017 10:20:37 +0200 Subject: SelTrans: fix inconsistencies with _norm, _grip, and rotation center There are some inconsistencies when displaying the _norm, _grip, and rotation center handles: 1. _norm and rotation center are not displayed on a black background; 2. _grip is never displayed, even though the code updates its position and even changes its shape depending on the operation performed. Fix these issues by using the XOR blending mode and, since the handles are only visible when dragging, set their color to 0xff0000b0 which is the color used by other handles when they are in the SP_KNOT_STATE_DRAGGING state. Moreover to have _grip properly blended when HANDLE_CENTER is moved _norm must be hidden, otherwise the two control point would overlap (both in shape and position) and the XOR blending would produce an unintuitive result. Finally, to effectively hide _norm, move forcing handles visibility _after_ grab() because grab() shows both _norm and _grip by default. Fixed bugs: - https://bugs.launchpad.net/inkscape/+bug/1707250 --- src/seltrans.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/seltrans.cpp') diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 1afb71f68..9e18bbe90 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -131,13 +131,13 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : _norm = sp_canvas_item_new(desktop->getControls(), SP_TYPE_CTRL, "anchor", SP_ANCHOR_CENTER, - "mode", SP_CTRL_MODE_COLOR, + "mode", SP_CTRL_MODE_XOR, "shape", SP_CTRL_SHAPE_BITMAP, "size", 13.0, "filled", TRUE, "fill_color", 0x00000000, "stroked", TRUE, - "stroke_color", 0x000000a0, + "stroke_color", 0xff0000b0, "pixbuf", handles[12], NULL); @@ -150,7 +150,7 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : "filled", TRUE, "fill_color", 0xffffff7f, "stroked", TRUE, - "stroke_color", 0xffffffff, + "stroke_color", 0xff0000b0, "pixbuf", handles[12], NULL); @@ -727,12 +727,16 @@ void Inkscape::SelTrans::handleClick(SPKnot */*knot*/, guint state, SPSelTransHa void Inkscape::SelTrans::handleGrab(SPKnot *knot, guint /*state*/, SPSelTransHandle const &handle) { + grab(knot->position(), handle.x, handle.y, FALSE, FALSE); + + // Forcing handles visibility must be done after grab() to be effective switch (handle.type) { case HANDLE_CENTER: g_object_set(G_OBJECT(_grip), "shape", SP_CTRL_SHAPE_BITMAP, "size", 13.0, NULL); + sp_canvas_item_hide(_norm); sp_canvas_item_show(_grip); break; default: @@ -744,8 +748,6 @@ void Inkscape::SelTrans::handleGrab(SPKnot *knot, guint /*state*/, SPSelTransHan sp_canvas_item_show(_grip); break; } - - grab(knot->position(), handle.x, handle.y, FALSE, FALSE); } -- cgit v1.2.3