summaryrefslogtreecommitdiffstats
path: root/src/gradient-context.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gradient-context.cpp')
-rw-r--r--src/gradient-context.cpp9
1 files changed, 8 insertions, 1 deletions
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