Code

fix live dragging of gradient midstops, and fix crash when dragging writes to repr
authorbuliabyak <buliabyak@users.sourceforge.net>
Sun, 25 Mar 2007 02:01:37 +0000 (02:01 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Sun, 25 Mar 2007 02:01:37 +0000 (02:01 +0000)
src/gradient-chemistry.cpp

index 0a312193dde1a063d750aee6b33322a91904005b..5ed49b2abb790bba182a0b1ca6abad78824d8a1b 100644 (file)
@@ -799,6 +799,7 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
             case POINT_LG_MID:
             {                              
                 // using X-coordinates only to determine the offset, assuming p has been snapped to the vector from begin to end.
+                sp_gradient_ensure_vector(gradient);
                 double offset = get_offset_between_points (p, NR::Point(lg->x1.computed, lg->y1.computed), NR::Point(lg->x2.computed, lg->y2.computed));
                 SPGradient *vector = sp_gradient_get_vector (lg, false);
                 lg->vector.stops.at(point_i).offset = offset;
@@ -807,7 +808,7 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
                 if (write_repr) {
                     sp_repr_set_css_double(SP_OBJECT_REPR(stopi), "offset", stopi->offset);
                 } else {
-                    SP_OBJECT (gradient)->requestModified(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
+                    SP_OBJECT (stopi)->requestModified(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
                 }
             }
             break;