Example #1
0
        /// <summary>
        /// When the user moves his mouse over the renderer, if the DOM element under the cursor
        /// changes, notifies the server of the identity of the new element under the mouse
        /// so that the clients can scroll there.
        /// </summary>
        protected override void renderer_DomMouseMove(object sender, GeckoDomMouseEventArgs e)
        {
            base.renderer_DomMouseMove (sender, e);
            if (!e.Target.Equals (currentNode))
            {
                currentNode = e.Target;
                if (currentNode != null)
                {
                    CurrentNodeChangedEventArgs args = null;
                    string tagId = null;

                    if (currentNode is GeckoElement)
                        tagId = (currentNode as GeckoElement).Id;

                    if (string.IsNullOrEmpty (tagId))
                    {
                        int domId = renderer.Document.DocumentElement.GetDomId (currentNode);
                        if (domId != 0) //throw new InvalidOperationException ("GetDomId returned a 0, this should never happen!");
                            args = new CurrentNodeChangedEventArgs (TabData, domId);
                    }
                    else
                    {
                        args = new CurrentNodeChangedEventArgs (TabData, tagId);
                    }

                    if (args != null)
                        RaiseEvent (args);
                }
            }
        }
Example #2
0
 /// <summary>
 /// Handler invoked when users scrolls a webpage
 /// </summary>
 private void documentPane_CurrentNodeChanged(object sender, CurrentNodeChangedEventArgs e)
 {
     if (ClientStatus.IsBroadcasting)
     {
         if (!String.IsNullOrEmpty (e.TagId))
             Connection.ScrollTabToTagId (e.Tab, e.TagId);
         else
             Connection.ScrollTabToDomId (e.Tab, e.DomId);
     }
 }