private void OnUnregisterClickable(object sender, EventArgs eventArgs) { if (sender is IClickable clickable) { Clickables.Remove(clickable); } }
protected virtual void OnEntityRemoved(Entity e) { var mp = Scene.View.LocalMousePosition; if (mouseDownEntity == e) { mouseDownEntity.ProcessMessage(MessageType.MouseUp, new System.Windows.Forms.MouseEventArgs(View.MouseButtons, 0, mp.X, mp.Y, 0)); mouseDownEntity = null; } if (MouseOverEntity == e) { MouseOverEntity.ProcessMessage(MessageType.MouseLeave, new System.Windows.Forms.MouseEventArgs(View.MouseButtons, 0, mp.X, mp.Y, 0)); MouseOverEntity = null; } if (IsClickable(e)) { Clickables.Remove(e); } e.ClickableChanged -= new EventHandler(UpdateEntityBounding); e.IsVisibleChanged -= new EventHandler(UpdateEntityBounding); e.PickingLocalBoundingChanged -= new EventHandler(UpdateEntityBounding); e.Transformed -= new EventHandler(UpdateEntityBounding); if (e.Updateable) { updateables.Remove(e); } }
void UpdateEntityBounding(object sender, EventArgs e) { var ent = (Entity)sender; if (IsClickable(ent)) { if (!Clickables.Contains(ent)) { Clickables.Insert(ent, ent.PickingWorldBounding); } else { Clickables.Move(((Entity)sender), ((Entity)sender).PickingWorldBounding); } } else { Clickables.Remove(ent); } }