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; } } }
internal void SelectHandle(SvgPathIndex pressIndex) { if (pressIndex != null) { CurrentIndex = new SvgPathIndex(pressIndex); } else { CurrentIndex = new SvgPathIndex(); } }
private SvgPathItem GetItem(SvgPathIndex currentIndex) { if (!CurrentIndex.IsValid()) { return(null); } var path = Paths[CurrentIndex.BlockIndex]; var item = path[CurrentIndex.ItemIndex]; return(item); }
internal bool MovePos(SvgPathIndex pressIndex, Vector2 pos) { var item = Paths[pressIndex.BlockIndex][pressIndex.ItemIndex]; return(item.MovePos(pressIndex.PartIndex, pos)); }
public SvgPathIndex(SvgPathIndex hoverIndex) { BlockIndex = hoverIndex.BlockIndex; ItemIndex = hoverIndex.ItemIndex; PartIndex = hoverIndex.PartIndex; }