// Called when undo'ing a zorder move. public void RestoreZOrder(List <ZOrderMap> zorder) { // Remove all shapes from the elements list. zorder.Select(zo => zo.Element).ForEach(el => elements.Remove(el)); // Insert them into the list in ascending order, so each insertion goes in the right place. zorder.OrderBy(zo => zo.Index).ForEach(zo => elements.Insert(zo.Index, zo.Element)); // TODO: Redraw everything, because I'm lazy and because this actually might be the best way of getting all the pieces to play nice together. canvas.Invalidate(); }
public void DeleteSelectedElements() { selectedAnchor = null; showingAnchorsElement = null; dragging = false; selectedElements.ForEach(el => { DeleteElement(el); }); selectedElements.Clear(); canvas.Invalidate(); }
public void DeleteSelectedElements() { selectedAnchor = null; showingAnchorsElement = null; dragging = false; // TODO: Optimize for redrawing just selected elements (we remove call to DeleteElement when we do this) selectedElements.ForEach(el => { el.GroupChildren.ForEach(child => child.Parent = null); DeleteElement(el); }); selectedElements.Clear(); canvas.Invalidate(); }
public void DeleteElement() { if (selectedElement != null) { selectedElement.DetachAll(); EraseTopToBottom(elements); elements.Remove(selectedElement); selectedElement.Dispose(); selectedElement = null; selectedAnchor = null; showingAnchorsElement = null; dragging = false; DrawBottomToTop(elements); ElementSelected.Fire(this, new ElementEventArgs()); // Need to refresh the entire screen to remove the element from the screen itself. canvas.Invalidate(); } }