We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Bug in Diagram Expander sample

The Diagram Expander Sample code has a bug.

How to reproduce:
- Start the demo
- Set LayoutDirection to "RightToLeft"
- Collapse the topmost node, this is the upper one of the two children of the root node, you should now see 8 remaining nodes
- Try to collapse the lowest node (it has two children)

Result:
The node does not react on collapse/expand mouse clicks

Cause:
The Form1.diagram1_MouseMove() method uses the controller's GetNodeAtPoint method to find the node under the mouse cursor. Since some of the nodes are hidden, the method will return node 10 (one of the collapsed ones), not node 5, the one we intended.

Solution:
The code should look like this:
var nodesAtPoint = diagram1.Controller.GetNodesAtPoint( diagram1.Controller.ConvertToModelCoordinates( e.Location ) );
foreachvar n in nodesAtPoint )
{
    var no = n as ExpanderNode;
    if( no != null )
    {
        if( no.Visible )
        {
            no.MouseMove( diagram1.Controller.ConvertToModelCoordinates( e.Location ) );
            break;
        }
    }
}
This iterates over all nodes at the give point and picks the first one that is visible.

Hope this helps somebody :-)




4 Replies

HK Heinz Kessler March 11, 2016 11:58 AM UTC

Correction:

The first line in my code below must be replaced by:
var clientCoordinates = diagram1.Controller.ConvertFromModelToClientCoordinates( diagram1.Controller.ConvertToModelCoordinates( e.Location ) );
var nodesAtPoint = diagram1.Controller.GetNodesAtPoint( clientCoordinates );




NG Naganathan Ganesh Babu Syncfusion Team March 14, 2016 12:55 PM UTC

Hi Heinz,
 
Thanks for contacting Syncfusion support.
 
We are unable to reproduce the reported issue at our end. Please refer to the below attached video for your references.
 
Video:
 
Video
 
Also please provide the version where the reported issue appears and please provide more information, probably your sample or video which will help us to analyze further and provide you with a better solution.
 
Regards,
 
Naganathan K G


HK Heinz Kessler March 15, 2016 07:16 AM UTC

Hello,
thanks for the reply. In your video, you did not reproduce the bug correctly.
I think, the video below will illustrate how to reproduce the bug.
The bug is reproducable with the latest version of SyncFusion Winforms.



NG Naganathan Ganesh Babu Syncfusion Team March 16, 2016 01:31 PM UTC

Hi Heinz,
 
Thanks for your update.
 
We are able to reproduce the reported issue at our end. However we have fixed and modified the expander sample. Please refer to the below sample.
 
Sample:
 
Sample
 
Regards,
 
Naganathan K G

Loader.
Live Chat Icon For mobile
Up arrow icon