Exemplo n.º 1
0
 public virtual void OnPointerExited(HtmlCanvasPointerRoutedEventArgs e)
 {
     if (PointerExited != null)
     {
         PointerExited(this, e);
     }
 }
Exemplo n.º 2
0
 public virtual void OnRightTapped(HtmlCanvasPointerRoutedEventArgs e)
 {
     if (RightTapped != null)
     {
         RightTapped(this, e);
     }
 }
Exemplo n.º 3
0
 void ToolTipOwner_PointerExited(object sender, HtmlCanvasPointerRoutedEventArgs e)
 {
     if (_toolTipContainer != null &&
         _toolTipContainer.IsOpen == true)
     {
         ToolTipService.CloseToolTip(_toolTipContainer);
     }
 }
Exemplo n.º 4
0
 void ToolTipOwner_PointerExited(object sender, HtmlCanvasPointerRoutedEventArgs e)
 {
     if (_toolTipContainer != null &&
         _toolTipContainer.IsOpen == true)
     {
         _toolTipContainer.IsOpen = false;
     }
 }
Exemplo n.º 5
0
        void ToolTipOwner_PointerEntered(object sender, HtmlCanvasPointerRoutedEventArgs e)
        {
            if (_toolTipContainer != null &&
                _toolTipContainer.IsOpen == false)
            {
#if MIGRATION
                Point absoluteCoordinates = e.GetPosition(null);
#else
                Point absoluteCoordinates = e.GetCurrentPoint(null).Position;
#endif
                Point absoluteCoordinatesShiftedToBeBelowThePointer = new Point(absoluteCoordinates.X, absoluteCoordinates.Y + 20);
                ToolTipService.OpenToolTipAt(_toolTipContainer, absoluteCoordinatesShiftedToBeBelowThePointer);
            }
        }
Exemplo n.º 6
0
        void HtmlCanvas_PointerMoved(object sender, PointerRoutedEventArgs e)
#endif
        {
            // Get the cursor position relative to this HtmlCanvas
#if MIGRATION
            Point pos = e.GetPosition(this);
#else
            Point pos = e.GetCurrentPoint(this).Position;
#endif

            // Get a stack of the HtmlCanvasElement directly under the cursor and all his parents
            // (Parent1, Parent2, ..., ElementDirectlyUnderTheCursor)
            HtmlCanvasElement[] elements = GetPointedElements(this, pos.X, pos.Y).ToArray();

            HtmlCanvasPointerRoutedEventArgs e2 = new HtmlCanvasPointerRoutedEventArgs(e, this);

            // Loop backward on every element of the stack
            for (int i = 0; i < elements.Length && !e.Handled; ++i)
            {
                // Remove the last element of the stack and call its OnPointerMoved() method
                elements[i].OnPointerMoved(e2);
            }

            if (_LastPointerMove != null)
            {
                e2 = new HtmlCanvasPointerRoutedEventArgs(e, this);
                for (int i = 0; i < elements.Length && !e.Handled; ++i)
                {
                    if (Array.IndexOf(_LastPointerMove, elements[i]) == -1)
                    {
                        elements[i].OnPointerEntered(e2);
                    }
                }

                e2 = new HtmlCanvasPointerRoutedEventArgs(e, this);
                for (int i = 0; i < _LastPointerMove.Length && !e.Handled; ++i)
                {
                    if (Array.IndexOf(elements, _LastPointerMove[i]) == -1)
                    {
                        _LastPointerMove[i].OnPointerExited(e2);
                    }
                }
            }

            _LastPointerMove = elements;
        }
Exemplo n.º 7
0
        void HtmlCanvas_PointerReleased(object sender, PointerRoutedEventArgs e)
#endif
        {
            // Get the cursor position relative to this HtmlCanvas
#if MIGRATION
            Point pos = e.GetPosition(this);
#else
            Point pos = e.GetCurrentPoint(this).Position;
#endif

            // Get a stack of the HtmlCanvasElement directly under the cursor and all his parents
            // (Parent1, Parent2, ..., ElementDirectlyUnderTheCursor)
            Stack <HtmlCanvasElement> elements = GetPointedElements(this, pos.X, pos.Y);

            HtmlCanvasPointerRoutedEventArgs e2 = new HtmlCanvasPointerRoutedEventArgs(e, this);

            // Loop backward on every element of the stack
            while (!e.Handled && elements.Count > 0)
            {
                // Remove the last element of the stack and call its OnPointerMoved() method
                elements.Pop().OnPointerReleased(e2);
            }
        }
        static void HtmlCanvasElement_RightTapped(object sender, HtmlCanvasPointerRoutedEventArgs e)
        {
            // Show the ContextMenu where the pointer is located:
            var htmlCanvasElement = (HtmlCanvasElement)sender;
            var contextMenu = htmlCanvasElement.ContextMenu;
            if (contextMenu != null)
            {
                if (contextMenu.IsOpen == false)
                {
#if MIGRATION
                    Point pointerPosition = e.GetPosition(null);
#else
                    Point pointerPosition = e.GetCurrentPoint(null).Position;
#endif
                    htmlCanvasElement.INTERNAL_RaiseContextMenuOpeningEvent(pointerPosition.X, pointerPosition.Y);
                    contextMenu.INTERNAL_OpenAtCoordinates(pointerPosition);
                }
            }
            else
            {
                UnregisterContextMenu(htmlCanvasElement);
            }
        }