From f8f1765c7dd464ed47e31b46842cca451959af7e Mon Sep 17 00:00:00 2001 From: buliabyak Date: Mon, 18 Feb 2008 09:57:41 +0000 Subject: [PATCH] fix picking color when dragging from empty space: from topmost, not last selected object --- src/gradient-context.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index b9b4308fc..2a4d3c91d 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -847,9 +847,16 @@ static void sp_gradient_drag(SPGradientContext &rc, NR::Point const pt, guint /* SPGradient *vector; if (ec->item_to_select) { + // pick color from the object where drag started vector = sp_gradient_vector_for_object(document, desktop, ec->item_to_select, fill_or_stroke); } else { - vector = sp_gradient_vector_for_object(document, desktop, SP_ITEM(selection->itemList()->data), fill_or_stroke); + // Starting from empty space: + // Sort items so that the topmost comes last + GSList *items = g_slist_copy ((GSList *) selection->itemList()); + items = g_slist_sort(items, (GCompareFunc) sp_item_repr_compare_position); + // take topmost + vector = sp_gradient_vector_for_object(document, desktop, SP_ITEM(g_slist_last(items)->data), fill_or_stroke); + g_slist_free (items); } // HACK: reset fill-opacity - that 0.75 is annoying; BUT remove this when we have an opacity slider for all tabs -- 2.30.2