Пример #1
0
        public SvgPathData(SvgEditData item, PolygonUnit polygonUnitValue)
        {
            CurrentIndex = new SvgPathIndex();
            var m_path = item?.GetPathData();

            Paths = new List <List <SvgPathItem> >();
            List <SvgPathItem> path = null;

            if (m_path != null)
            {
                SvgPathItem top   = null;
                SvgPathItem befor = null;
                foreach (var p in m_path)
                {
                    if (p.Command == 'm' || p.Command == 'M')
                    {
                        befor = null;
                        top   = p;
                        path  = new List <SvgPathItem>();
                        path.Add(p);
                        Paths.Add(path);
                    }
                    else if (path != null)
                    {
                        path.Add(p);
                    }
                    if (befor != null)
                    {
                        befor.Next = p;
                    }
                    befor = p;
                }
            }
        }
Пример #2
0
 internal void SelectHandle(SvgPathIndex pressIndex)
 {
     if (pressIndex != null)
     {
         CurrentIndex = new SvgPathIndex(pressIndex);
     }
     else
     {
         CurrentIndex = new SvgPathIndex();
     }
 }
Пример #3
0
        private SvgPathItem GetItem(SvgPathIndex currentIndex)
        {
            if (!CurrentIndex.IsValid())
            {
                return(null);
            }


            var path = Paths[CurrentIndex.BlockIndex];
            var item = path[CurrentIndex.ItemIndex];

            return(item);
        }
Пример #4
0
        internal bool MovePos(SvgPathIndex pressIndex, Vector2 pos)
        {
            var item = Paths[pressIndex.BlockIndex][pressIndex.ItemIndex];

            return(item.MovePos(pressIndex.PartIndex, pos));
        }
Пример #5
0
 public SvgPathIndex(SvgPathIndex hoverIndex)
 {
     BlockIndex = hoverIndex.BlockIndex;
     ItemIndex  = hoverIndex.ItemIndex;
     PartIndex  = hoverIndex.PartIndex;
 }