private void UpdateShapeHover(PointF pt) { if (!UseActiveContent || m_Page == null) { return; } Shape shapeHit = m_Page.HitTest(pt, m_Zoom, Page.HitTestMode.ActiveContent); if (!(shapeHit is ButtonShape)) { shapeHit = null; } if (shapeHit != m_ShapeHover) { ClearShapeHover(); if (m_ShapePressed != null && m_ShapePressed != shapeHit) { return; // if a button is pressed, we don't show any hover feedback over other buttons } m_ShapeHover = (ButtonShape)shapeHit; if (m_ShapeHover != null && m_ShapeHover.State == ButtonShape.States.Normal) { m_ShapeHover.State = m_ShapePressed == shapeHit ? ButtonShape.States.Selected : ButtonShape.States.Highlight; } HoverShapeChanged?.Invoke(m_ShapeHover); } }
/// <summary>called on mouse exit</summary> private void ClearShapeHover() { if (m_ShapeHover != null) // clear old selection { if (m_ShapeHover.State == ButtonShape.States.Highlight || m_ShapeHover.State == ButtonShape.States.Selected && m_ShapeHover.SelectDuringUserPress) { // Only deselect if it was responding to the presence of the mouse m_ShapeHover.State = ButtonShape.States.Normal; } m_ShapeHover = null; HoverShapeChanged?.Invoke(m_ShapeHover); } }