Issue with relative move in a multisegment path

Aug 12, 2010 at 6:24 AM

Hello,

There is an issue when a path has multiple segments, and there is a relative move after a close segment.

In SvgPathBuilder.cs:

The method ToAbsolute on the line

                var lastSegment = segments.Last;

will return a pointer to SvgClosePathSegment, which has 0 values for points, this is bad for a relative move.

As a workaround, I've modified the property Last in the file SvgSegmentList.cs from

        public SvgPathSegment Last
        {
            get { return this._segments[this._segments.Count - 1]; }
        }

to

        public SvgPathSegment Last
        {
            get {
                // TODO : If last entry is SvgClosePathSegment, then return 2nd last entry
                // Otherwise Start and End are 0s - not good for a relative move.
                if (this._segments[this._segments.Count-1].GetType() != typeof(SvgClosePathSegment))
                    return this._segments[this._segments.Count-1]; 
                else
                    return this._segments[this._segments.Count - 2]; 
            }
        }

 

 

 

 

Aug 12, 2010 at 6:30 AM

This was meant for the Issue tracker...