public void DeleteElement(GraphicElement el) { el.DetachAll(); EraseTopToBottom(elements); elements.Remove(el); el.Dispose(); DrawBottomToTop(elements); }
public void DeleteElement(GraphicElement el) { // TODO: don't redraw all the elements, only erase the current element and update the screen! // See how this is done with Ungroup. el.DetachAll(); EraseTopToBottom(elements); elements.Remove(el); el.Dispose(); DrawBottomToTop(elements); }
// Used by secondary operations, particularly undo events, where we delete things we've pasted or dropped onto the canvas. public void DeleteElement(GraphicElement el, bool dispose = true) { selectedElements.Remove(el); el.DetachAll(); var els = EraseIntersectionsTopToBottom(el); List <GraphicElement> elsToRedraw = els.ToList(); elsToRedraw.Remove(el); el.Connections.ForEach(c => c.ToElement.RemoveConnection(c.ToConnectionPoint.Type)); el.Connections.Clear(); DrawBottomToTop(elsToRedraw); UpdateScreen(els); // Original list, so element that is being deleted is included in the region to update. RemoveElement(el, dispose); }
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(); } }
// Used by secondary operations, particularly undo events, where we delete things we've pasted or dropped onto the canvas. public void DeleteElement(GraphicElement el, bool dispose = true) { // TODO: don't redraw all the elements, only erase the current element and update the screen! // See how this is done with Ungroup. el.DetachAll(); var els = EraseIntersectionsTopToBottom(el); elements.Remove(el); List <GraphicElement> elsToRedraw = els.ToList(); elsToRedraw.Remove(el); el.Connections.ForEach(c => c.ToElement.RemoveConnection(c.ToConnectionPoint.Type)); el.Connections.Clear(); DrawBottomToTop(elsToRedraw); UpdateScreen(els); if (dispose) { el.Dispose(); } selectedElements.Remove(el); }