private void HandleMouseOver() { var mousePos = Input.mousePosition; var ray = camera.ScreenPointToRay(mousePos); var hits = Physics.RaycastAll(ray, clickMaxDistance); var wasHit = false; if (!uiManager.IsMouseOverUI()) { foreach (var hitInfo in hits) { var obj = hitInfo.collider.gameObject; if (lastMouseOver && lastMouseOver.GetInstanceID() == obj.GetInstanceID()) { return; } var name = hitInfo.collider.name; if (name.IndexOf("::", StringComparison.OrdinalIgnoreCase) > 0 || hitInfo.collider.tag == "NPC" || hitInfo.collider.tag == "Player" || hitInfo.collider.transform.parent.tag == "NPC") { wasHit = true; MouseEnter?.Invoke(this, new MouseClickEventArgs(-1, hitInfo)); lastMouseOver = obj; break; } } } if (!wasHit && lastMouseOver) { OnMouseLeave(); } }
public override void Update(GameTime gameTime, Input input) { base.Update(gameTime, input); Content?.Update(gameTime, input); var currentMouseStatus = input.MouseStatus; var containsCurrentPosition = Bounds.Contains(currentMouseStatus.Position); var containsPreviousPosition = Bounds.Contains(_previousMouseStatus.Position); if (containsCurrentPosition && !containsPreviousPosition) { MouseEnter?.Invoke(); } else if (!containsCurrentPosition && containsPreviousPosition) { MouseLeave?.Invoke(); } else if (containsCurrentPosition) { MouseHover?.Invoke(); } if (containsCurrentPosition && currentMouseStatus.IsButtonJustPressed(MouseButtons.Left)) { Click?.Invoke(); } }
public virtual void onMouseEnter(object sender, MouseMoveEventArgs e) { #if DEBUG_FOCUS Debug.WriteLine("MouseEnter => " + this.ToString()); #endif MouseEnter.Raise (this, e); }
public void OnPointerEnter(PointerEventData eventData) { if (MouseEnter != null) { MouseEnter.Invoke(this, eventData); } }
internal void OnMouseEnter(EventArgs e) { if (MouseEnter != null) { MouseEnter.Invoke(this, e); } }
/// <summary> /// Called when the mouse first enters the control. Raises the MouseEnter event and calls the <see cref="DetermineAppearance"/> method. /// </summary> /// <param name="state">The current mouse data</param> protected virtual void OnMouseEnter(Input.MouseConsoleState state) { isMouseOver = true; MouseEnter?.Invoke(this, new MouseEventArgs(state)); DetermineAppearance(); }
public Button(View parent, View layoutParent = null, string id = null, Template template = null, Action <View> initializer = null) : base(parent, layoutParent, id, template ?? ButtonTemplates.Default, initializer) { // constructing Label (Label) Label = new Label(this, this, "Label", LabelTemplate); // binding <Label Offset="{TextOffset}"> Bindings.Add(new Binding(new List <BindingPath> { new BindingPath(new List <string> { "TextOffset" }, new List <Func <BindableObject> > { () => this }) }, new BindingPath(new List <string> { "Label", "Offset" }, new List <Func <BindableObject> > { () => this, () => Label }), () => Label.Offset = TextOffset, () => { }, false)); Click.RegisterHandler(this, "ButtonMouseClick"); MouseEnter.RegisterHandler(this, "ButtonMouseEnter"); MouseExit.RegisterHandler(this, "ButtonMouseExit"); MouseDown.RegisterHandler(this, "ButtonMouseDown"); MouseUp.RegisterHandler(this, "ButtonMouseUp"); this.AfterInitializeInternal(); }
private void Viewport_MouseMove(Ray3 ray, System.Windows.Forms.MouseEventArgs e) { if (SurfaceMesh == null) { return; } List <Intersection> Intersections = new List <Intersection>(); Intersections.AddRange(SurfaceMesh.Intersect(ray)); if (Intersections.Count == 0 && IsMouseOver) { IsMouseOver = false; MouseLeave?.Invoke(this, e); } else if (Intersections.Count > 0) { Intersections.Sort((i1, i2) => i1.Distance.CompareTo(i2.Distance)); if (!IsMouseOver) { IsMouseOver = true; MouseEnter?.Invoke(this, Intersections, e); } MouseMove?.Invoke(this, Intersections, e); } }
public FileViewerInternal() { InitializeComponent(); InitializeComplete(); _currentViewPositionCache = new CurrentViewPositionCache(this); TextEditor.TextChanged += (s, e) => TextChanged?.Invoke(s, e); TextEditor.ActiveTextAreaControl.VScrollBar.ValueChanged += (s, e) => ScrollPosChanged?.Invoke(s, e); TextEditor.ActiveTextAreaControl.TextArea.KeyUp += (s, e) => KeyUp?.Invoke(s, e); TextEditor.ActiveTextAreaControl.TextArea.DoubleClick += (s, e) => DoubleClick?.Invoke(s, e); TextEditor.ActiveTextAreaControl.TextArea.MouseMove += (s, e) => MouseMove?.Invoke(s, e); TextEditor.ActiveTextAreaControl.TextArea.MouseEnter += (s, e) => MouseEnter?.Invoke(s, e); TextEditor.ActiveTextAreaControl.TextArea.MouseLeave += (s, e) => MouseLeave?.Invoke(s, e); TextEditor.ActiveTextAreaControl.TextArea.MouseDown += (s, e) => { SelectedLineChanged?.Invoke( this, new SelectedLineEventArgs( TextEditor.ActiveTextAreaControl.TextArea.TextView.GetLogicalLine(e.Y))); }; HighlightingManager.Manager.DefaultHighlighting.SetColorFor("LineNumbers", new HighlightColor(Color.FromArgb(80, 0, 0, 0), Color.White, false, false)); TextEditor.ActiveTextAreaControl.TextEditorProperties.EnableFolding = false; _lineNumbersControl = new DiffViewerLineNumberControl(TextEditor.ActiveTextAreaControl.TextArea); VRulerPosition = AppSettings.DiffVerticalRulerPosition; }
// this handler is called at each mouse Enter/Leave movement private void _mouseEnterLeave(object sender, System.EventArgs e) { Rectangle cr = RectangleToScreen(ClientRectangle); Point mp = MousePosition; // actual state bool isOver = cr.Contains(mp); // test if status changed if (_mouseOver ^ isOver) { // update state _mouseOver = isOver; if (_mouseOver) { MouseEnter?.Invoke(this, EventArgs.Empty); } else { MouseLeave?.Invoke(this, EventArgs.Empty); } } // update UpDownButtons visibility if (_showUpDownButtons != ShowUpDownButtonsMode.Always) { UpdateUpDownButtonsVisibility(); } }
public void UpdateControl(float dt) { var mouseState = Microsoft.Xna.Framework.Input.Mouse.GetState(); if (Rectangle.Contains(mouseState.Position)) { if (isHoverd == false) { MouseEnter?.Invoke(this, EventArgs.Empty); } isHoverd = true; if (mouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed) { isClicked = true; } else if (mouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Released && isClicked) { isClicked = false; MouseClick?.Invoke(this, EventArgs.Empty); } } else { if (isHoverd) { MouseLeave?.Invoke(this, EventArgs.Empty); } isHoverd = false; } }
public override void Update(GameTime time, MouseState mouse, Vector2 position) { if (IsIn(position, mouse)) { if (previousState == ControlMS.None) { MouseEnter?.Invoke(this, mouse); State = ControlMS.Hot; } else if ((mouse.LeftButton == ButtonState.Pressed || mouse.RightButton == ButtonState.Pressed) && previousState != ControlMS.Pressed) { MouseDown?.Invoke(this, mouse); State = ControlMS.Pressed; } else if (mouse.LeftButton == ButtonState.Released && mouse.RightButton == ButtonState.Released && previousState == ControlMS.Pressed) { MouseUp?.Invoke(this, mouse); State = ControlMS.Hot; } } else { if (previousState != ControlMS.None) { MouseLeave?.Invoke(this, mouse); State = ControlMS.None; } } previousState = State; }
/// <summary> /// マウスが入ったときの処理です /// </summary> /// <param name="mouseEvent"></param> protected void OnMouseEnter(MouseEvent mouseEvent) { if (MouseEnter != null) { MouseEnter.Invoke(this, mouseEvent); } }
/// <summary> /// Handles most events of the control /// </summary> /// <param name="eventName">Type of event to raise</param> /// <remarks></remarks> public void DoEvent(LightweightEvents eventName) { switch (eventName) { case LightweightEvents.Click: DoClick(); break; case LightweightEvents.MouseDown: if (canClick) { isPressed = true; Redraw(); } MouseDown?.Invoke(this, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0)); break; case LightweightEvents.MouseUp: if (canClick) { isPressed = false; Redraw(); } MouseUp?.Invoke(this, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0)); break; case LightweightEvents.MouseEnter: Scrolling = true; MouseEnter?.Invoke(this, new EventArgs()); break; case LightweightEvents.MouseLeave: Scrolling = false; MouseLeave?.Invoke(this, new EventArgs()); break; case LightweightEvents.Update: Update?.Invoke(this, null); break; case LightweightEvents.DoubleClick: DoubleClick?.Invoke(this, new EventArgs()); break; case LightweightEvents.MouseMove: MouseMove?.Invoke(this, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0)); break; default: throw new NotImplementedException("The requested event for this control does not exist"); } }
private static void ProcessWindowEvent(SdlEvent evt) { // Window Focus if (evt.window.windowEvent == SdlWindowEventId.SdlWindoweventFocusGained) { Engine.Active = true; if (!OsxUseSpaces) { SDL_SetWindowFullscreen( _window, Engine.Fullscreen ? (uint)SdlWindowFlags.SdlWindowFullscreenDesktop : 0 ); } // Disable the screensaver when we're back. SDL_DisableScreenSaver(); } else if (evt.window.windowEvent == SdlWindowEventId.SdlWindoweventFocusLost) { Engine.Active = false; if (!OsxUseSpaces) { SDL_SetWindowFullscreen(_window, 0); } SDL_EnableScreenSaver(); } // Window Resize else if (evt.window.windowEvent == SdlWindowEventId.SdlWindoweventSizeChanged) { var w = evt.window.data1; var h = evt.window.data2; _displayW = w; _displayH = h; Engine.HandleWindowResize(); } else if (evt.window.windowEvent == SdlWindowEventId.SdlWindoweventExposed) { Engine.RunningGame.Tick(); } else if (evt.window.windowEvent == SdlWindowEventId.SdlWindoweventEnter) { SDL_DisableScreenSaver(); MouseEnter?.Invoke(); } else if (evt.window.windowEvent == SdlWindowEventId.SdlWindoweventLeave) { SDL_EnableScreenSaver(); MouseLeave?.Invoke(); } }
protected virtual bool OnMouseEnter() { IsMouseOver = true; var args = new HandledEventArgs(); MouseEnter?.Invoke(args); return(args.Handled); }
public void OnMouseEnter() { if (EventSystem.current.IsPointerOverGameObject()) { return; } MouseEnter?.Invoke(this, new EventArgs()); }
public ListItem(View parent, View layoutParent = null, string id = null, Template template = null, Action <View> initializer = null) : base(parent, layoutParent, id, template ?? ListItemTemplates.Default, initializer) { Click.RegisterHandler(this, "ListItemMouseClick"); MouseEnter.RegisterHandler(this, "ListItemMouseEnter"); MouseExit.RegisterHandler(this, "ListItemMouseExit"); MouseDown.RegisterHandler(this, "ListItemMouseDown"); MouseUp.RegisterHandler(this, "ListItemMouseUp"); this.AfterInitializeInternal(); }
private void Parent_MouseEnter(object sender, MouseEventArgs e) { if (!Pressed) { return; } Pressed = (LeftButton ? e.LeftButton : e.RightButton) == MouseButtonState.Pressed; MouseEnter?.Invoke(sender, e); }
public virtual void OnMouseEnter(DxWindow window, DxControl ctl, MouseEventArgs args, Point pt) { if (IsMouseOver) { return; } IsMouseOver = true; MouseEnter?.Invoke(ctl, args, pt); }
private void Gc_MouseEnter(object sender, EventArgs e) { if (EnsureCurrent) { glControl.MakeCurrent(); } Point relcurpos = FindCursorFormCoords(); var ev = new GLMouseEventArgs(relcurpos); MouseEnter?.Invoke(this, ev); }
protected virtual void OnMouseEnter(GLMouseEventArgs e) { //System.Diagnostics.Debug.WriteLine("enter " + Name + " " + e.Location + " " + InvalidateOnEnterLeave); MouseEnter?.Invoke(this, e); if (InvalidateOnEnterLeave) { //System.Diagnostics.Debug.WriteLine($"Invalid on enter {Name}"); Invalidate(); } }
public Button(View parent, View layoutParent = null, string id = null, Template template = null, bool deferInitialization = false) : base(parent, layoutParent, id, template ?? ButtonTemplates.Default, deferInitialization) { if (deferInitialization) { return; } // constructing Label (Label) Label = new Label(this, this, "Label", LabelTemplate); // binding <Label Offset="{TextOffset}"> Bindings.Add(new Binding(new List <BindingPath> { new BindingPath(new List <string> { "TextOffset" }, new List <Func <object> > { () => this }) }, new BindingPath(new List <string> { "Label", "Offset" }, new List <Func <object> > { () => this, () => Label }), () => Label.Offset = TextOffset, () => { }, false)); // binding <Label IsActive="{DisplayLabel}"> Bindings.Add(new Binding(new List <BindingPath> { new BindingPath(new List <string> { "DisplayLabel" }, new List <Func <object> > { () => this }) }, new BindingPath(new List <string> { "Label", "IsActive" }, new List <Func <object> > { () => this, () => Label }), () => Label.IsActive = DisplayLabel, () => { }, false)); this.StateAnimations.Clear(); var stateAnimation0 = new StateAnimation(AnyStateName, "Highlighted"); stateAnimation0.Add(new Animator <UnityEngine.Color>(this, 0.05f, 0f, false, false, 0f, false, EasingFunctions.Get("Linear"), Delight.ColorValueConverter.Interpolator, x => this.BackgroundColor = x, () => this.BackgroundColor, () => Button.BackgroundColorProperty.NotifyPropertyChanged(this), Button.BackgroundColorProperty, AnyStateName, "Highlighted")); stateAnimation0.Add(new Animator <UnityEngine.Color>(this, 0.05f, 0f, false, false, 0f, false, EasingFunctions.Get("Linear"), Delight.ColorValueConverter.Interpolator, x => this.FontColor = x, () => this.FontColor, () => Button.FontColorProperty.NotifyPropertyChanged(this), Button.FontColorProperty, AnyStateName, "Highlighted")); this.StateAnimations.Add(stateAnimation0); var stateAnimation1 = new StateAnimation("Highlighted", DefaultStateName); stateAnimation1.Add(new Animator <UnityEngine.Color>(this, 0.5f, 0f, false, false, 0f, false, EasingFunctions.Get("Linear"), Delight.ColorValueConverter.Interpolator, x => this.BackgroundColor = x, () => this.BackgroundColor, () => Button.BackgroundColorProperty.NotifyPropertyChanged(this), Button.BackgroundColorProperty, "Highlighted", DefaultStateName)); stateAnimation1.Add(new Animator <UnityEngine.Color>(this, 0.5f, 0f, false, false, 0f, false, EasingFunctions.Get("Linear"), Delight.ColorValueConverter.Interpolator, x => this.FontColor = x, () => this.FontColor, () => Button.FontColorProperty.NotifyPropertyChanged(this), Button.FontColorProperty, "Highlighted", DefaultStateName)); this.StateAnimations.Add(stateAnimation1); Click.RegisterHandler(this, "ButtonMouseClick"); MouseEnter.RegisterHandler(this, "ButtonMouseEnter"); MouseExit.RegisterHandler(this, "ButtonMouseExit"); MouseDown.RegisterHandler(this, "ButtonMouseDown"); MouseUp.RegisterHandler(this, "ButtonMouseUp"); this.AfterInitializeInternal(); }
public virtual void OnMouseEnter() { if (!_Enabled) { return; } if (MouseEnter != null) { MouseEnter.Invoke(this, EventArgs.Empty); } }
public override void Dispose() { _aggregator.Unsubscribe(Entity); MouseEnter?.Dispose(); MouseLeave?.Dispose(); MouseMove?.Dispose(); MouseClicked?.Dispose(); MouseDoubleClicked?.Dispose(); MouseDown?.Dispose(); MouseUp?.Dispose(); LostFocus?.Dispose(); base.Dispose(); }
internal void OnMouseEnter(MouseEventArgs args) { HoverState = HoverStates.Hovering; foreach (var button in MouseButtonStates.Where(x => x.Value == ButtonState.Pressed).ToList()) { if (!args.Buttons.Contains(button.Key)) { MouseButtonStates[button.Key] = ButtonState.Released; } } MouseEnter?.Invoke(this, args); ChangeVisualState(); }
private async Task onRepeatedlyExecute(object sender, EventArgs args) { if (!_enabled.Enabled || !_visible.Visible) { return; } IRoom room = _state.Room; if (room == null) { return; } PointF position = _input.MousePosition; var obj = room.GetObjectAt(position.X, position.Y); bool mouseIn = obj == _entity; bool leftMouseDown = _input.LeftMouseButtonDown; bool rightMouseDown = _input.RightMouseButtonDown; bool fireMouseMove = mouseIn && (_mouseX != position.X || _mouseY != position.Y); bool fireMouseEnter = mouseIn && !IsMouseIn; bool fireMouseLeave = !mouseIn && IsMouseIn; _mouseX = position.X; _mouseY = position.Y; IsMouseIn = mouseIn; bool wasLeftMouseDown = _leftMouseDown; bool wasRightMouseDown = _rightMouseDown; _leftMouseDown = leftMouseDown; _rightMouseDown = rightMouseDown; await handleMouseButton(_leftMouseClickTimer, _leftMouseDoubleClickTimer, wasLeftMouseDown, leftMouseDown, MouseButton.Left); await handleMouseButton(_rightMouseClickTimer, _rightMouseDoubleClickTimer, wasRightMouseDown, rightMouseDown, MouseButton.Right); if (fireMouseEnter) { await MouseEnter.InvokeAsync(_entity, new MousePositionEventArgs (position.X, position.Y)); } else if (fireMouseLeave) { await MouseLeave.InvokeAsync(_entity, new MousePositionEventArgs (position.X, position.Y)); } if (fireMouseMove) { await MouseMove.InvokeAsync(_entity, new MousePositionEventArgs(position.X, position.Y)); } }
protected virtual void OnMouseEnter() { if (!_enabled) { return; } Redraw(); if (MouseEnter != null) { MouseEnter.Invoke(this, EventArgs.Empty); } }
public void OnUpdate() { if (!wasInside && Mouse.CursorInside(this)) { wasInside = true; MouseEnter?.Invoke(); } if (wasInside && !Mouse.CursorInside(this)) { wasInside = false; MouseLeft?.Invoke(); } }
public GridSplitterHandle(View parent, View layoutParent = null, string id = null, Template template = null, Action <View> initializer = null) : base(parent, layoutParent, id, template ?? GridSplitterHandleTemplates.Default, initializer) { // constructing Image (SplitterHandle) SplitterHandle = new Image(this, this, "SplitterHandle", SplitterHandleTemplate); Drag.RegisterHandler(this, "OnDrag"); BeginDrag.RegisterHandler(this, "OnBeginDrag"); InitializePotentialDrag.RegisterHandler(this, "OnInitializePotentialDrag"); EndDrag.RegisterHandler(this, "OnEndDrag"); MouseEnter.RegisterHandler(this, "OnMouseEnter"); MouseExit.RegisterHandler(this, "OnMouseExit"); ContentContainer = SplitterHandle; this.AfterInitializeInternal(); }