示例#1
0
        private void HandleTouchNotification(TouchNotification n, CallerInfo caller)
        {
            var position   = GetPositionInViewport(n, caller);
            var touchEvent = new CefTouchEvent()
            {
                Id = n.Id,
                //Modifiers = (CefEventFlags)((int)(FKeyboard.Modifiers) >> 15),
                PointerType   = CefPointerType.Touch,
                Pressure      = 1f,
                RadiusX       = n.ContactArea.X,
                RadiusY       = n.ContactArea.Y,
                RotationAngle = 0,
                Type          = GetTouchType(n.Kind),
                X             = position.X,
                Y             = position.Y
            };

            webRenderer.BrowserHost.SendTouchEvent(touchEvent);

            CefTouchEventType GetTouchType(TouchNotificationKind kind)
            {
                switch (kind)
                {
                case TouchNotificationKind.TouchDown:
                    return(CefTouchEventType.Pressed);

                case TouchNotificationKind.TouchUp:
                    return(CefTouchEventType.Released);

                case TouchNotificationKind.TouchMove:
                    return(CefTouchEventType.Moved);

                default:
                    return(CefTouchEventType.Cancelled);
                }
            }
        }
 /// <summary>
 /// Send a touch event to the browser for a windowless browser.
 /// </summary>
 public void SendTouchEvent(CefTouchEvent @event)
 {
     BrowserHost?.SendTouchEvent(@event);
 }
示例#3
0
 /// <summary>
 /// Send a touch event to the browser.
 /// </summary>
 /// <param name="eventInfo">The touch event information.</param>
 public void SendTouchEvent(CefTouchEvent eventInfo)
 {
     this.BrowserObject?.Host.SendTouchEvent(eventInfo);
 }