diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2007-04-01 16:39:58 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2007-04-01 16:39:58 +0000 |
| commit | e9e569c09ffd5e5f2d768bbc1f476e311245d1d1 (patch) | |
| tree | 23f396479bc93d9e5ffd7e499872f47a31463e42 /src/gradient-drag.cpp | |
| parent | added clarifying comment (diff) | |
| download | inkscape-e9e569c09ffd5e5f2d768bbc1f476e311245d1d1.tar.gz inkscape-e9e569c09ffd5e5f2d768bbc1f476e311245d1d1.zip | |
when the gradient just has start and end stops if you delete one it will now color the object the remaining stop's color.
(bzr r2799)
Diffstat (limited to 'src/gradient-drag.cpp')
| -rw-r--r-- | src/gradient-drag.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 32dfe4d71..5801489fe 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -1745,11 +1745,31 @@ GrDrag::deleteSelected (bool just_one) else { // delete the gradient from the object. set fill to unset FIXME: set to fill of unselected node? SPCSSAttr *css = sp_repr_css_attr_new (); - if (stopinfo->draggable->fill_or_stroke) { - sp_repr_css_unset_property (css, "fill"); + + // stopinfo->spstop is the selected stop + Inkscape::XML::Node *unselectedrepr = SP_OBJECT_REPR(stopinfo->vector)->firstChild(); + if (unselectedrepr == SP_OBJECT_REPR(stopinfo->spstop) ) { + unselectedrepr = unselectedrepr->next(); + } + + if (unselectedrepr == NULL) { + if (stopinfo->draggable->fill_or_stroke) { + sp_repr_css_unset_property (css, "fill"); + } else { + sp_repr_css_unset_property (css, "stroke"); + } } else { - sp_repr_css_unset_property (css, "stroke"); + SPCSSAttr *stopcss = sp_repr_css_attr(unselectedrepr, "style"); + if (stopinfo->draggable->fill_or_stroke) { + sp_repr_css_set_property(css, "fill", sp_repr_css_property(stopcss, "stop-color", "inkscape:unset")); + sp_repr_css_set_property(css, "fill-opacity", sp_repr_css_property(stopcss, "stop-opacity", "1")); + } else { + sp_repr_css_set_property(css, "stroke", sp_repr_css_property(stopcss, "stop-color", "inkscape:unset")); + sp_repr_css_set_property(css, "stroke-opacity", sp_repr_css_property(stopcss, "stop-opacity", "1")); + } + sp_repr_css_attr_unref (stopcss); } + sp_repr_css_change (SP_OBJECT_REPR (stopinfo->draggable->item), css, "style"); sp_repr_css_attr_unref (css); } |
