public override void DeselectGroupedElements() { List <GraphicElement> elementsToRemove = new List <GraphicElement>(); selectedElements.Where(el => el.Parent != null).ForEach(el => { var els = EraseIntersectionsTopToBottom(el); el.Selected = false; DrawBottomToTop(els); UpdateScreen(els); elementsToRemove.Add(el); }); elementsToRemove.ForEach(el => selectedElements.Remove(el)); if (selectedElements.Count == 0) { ElementSelected.Fire(this, new ElementEventArgs() { Element = null }); } else { // Select the first element. // TODO: This needs to fire an event that can handle the group of selected elements, // particularly for PropertyGrid handling. ElementSelected.Fire(this, new ElementEventArgs() { Element = selectedElements[0] }); } }
// Deselect all other elements. public override void SelectOnlyElement(GraphicElement el) { List <GraphicElement> intersections = FindAllIntersections(el).ToList(); List <GraphicElement> deselectedElements = new List <GraphicElement>(); selectedElements.Where(e => e != el).ForEach(e => { intersections.AddRange(FindAllIntersections(e)); e.Deselect(); deselectedElements.Add(e); }); if (!selectedElements.Contains(el)) { selectedElements.Add(el); el.Select(); } deselectedElements.ForEach(e => selectedElements.Remove(e)); EraseTopToBottom(intersections); DrawBottomToTop(intersections); UpdateScreen(intersections); ElementSelected.Fire(this, new ElementEventArgs() { Element = el }); }
public void SelectElement(GraphicElement el) { DeselectCurrentSelectedElement(); var els = EraseTopToBottom(el); el.Selected = true; DrawBottomToTop(els); UpdateScreen(els); selectedElement = el; ElementSelected.Fire(this, new ElementEventArgs() { Element = el }); }
public override void DeselectCurrentSelectedElements() { selectedElements.ForEach(el => { var els = EraseIntersectionsTopToBottom(el); el.Selected = false; DrawBottomToTop(els); UpdateScreen(els); }); selectedElements.Clear(); ElementSelected.Fire(this, new ElementEventArgs() { Element = null }); }
public override void SelectElement(GraphicElement el) { // Add to selected elements only once! if (!selectedElements.Contains(el)) { var els = EraseIntersectionsTopToBottom(el); selectedElements.Add(el); el.Selected = true; DrawBottomToTop(els); UpdateScreen(els); ElementSelected.Fire(this, new ElementEventArgs() { Element = el }); } }
protected void OnMouseDown(object sender, MouseEventArgs args) { if (args.Button == MouseButtons.Left) { leftMouseDown = true; DeselectCurrentSelectedElement(); SelectElement(args.Location); selectedAnchor = selectedElement?.GetAnchors().FirstOrDefault(a => a.Near(mousePosition)); ElementSelected.Fire(this, new ElementEventArgs() { Element = selectedElement }); dragging = selectedElement != null; mousePosition = args.Location; } }
public override void SelectElement(GraphicElement el) { DeselectCurrentSelectedElement(); if (el != null) { var els = EraseIntersectionsTopToBottom(el); el.Select(); DrawBottomToTop(els); UpdateScreen(els); selectedElements.Add(el); ElementSelected.Fire(this, new ElementEventArgs() { Element = el }); } }
public override void SelectElement(GraphicElement el) { // Add to selected elements only once! if (!selectedElements.Contains(el)) { var els = EraseIntersectionsTopToBottom(el); selectedElements.Add(el); el.Select(); DrawBottomToTop(els); UpdateScreen(els); ElementSelected.Fire(this, new ElementEventArgs() { Element = el }); // Added this to support the NavTo feature, so that the element // can override this behavior (which is empty in the GraphicElement) // to do other things AFTER the rendering of the selected element has taken place. el.ElementSelected(); } }