/// <summary>Promotes this <see cref="SVGExplorer"/> form been a simple <see cref="drawing"/> holder to become a <see cref="view"/> holder and be able to handle mouse events, transforms etc. /// You probalby should not need to call this method manually, as the element will promote itself when you accesses more advanced properties.</summary> public void promote() { if (view != null) { return; } var prs = parent.view.RemoveTop(drawing); //parent.view.RemoveDrawing(drawing); //view = new SVGView(); //view.AddDrawing(drawing); foreach (var cd in prs) { var cv = new SVGView(); cv.AddDrawing(cd); if (view == null) { view = cv; } parent.view.Children.Add(cv); } //parent.view.Children.Add(view); drawing = null; }
private void initialize() { name = name ?? root.getDrawingID(drawing); if (drawing is DrawingGroup dg) { drawing = null; view = new SVGView(); view.RenderTransform = dg.Transform; SVGView v = null; SVGExplorer e = null; foreach (var d in dg.Children) { var ch = new SVGExplorer(d, this, root); //if (d is GlyphRunDrawing grd) // grd.GlyphRun..Characters = "xxx".ToList(); childs.Add(ch); if (ch.name != null) { namesMap.Add(ch.name, ch); } if (ch.drawing != null) { view.AddDrawing(ch.drawing); if (v != null) { ch.promote(); } } else { view.Children.Add(ch.view); v = ch.view; } } } }