Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic drag the node.MasterGroup.MainItem (Read 2003 times)
D
Full Member
***
Offline


I Love MindFusion!

Posts: 158
Joined: Mar 16th, 2020
drag the node.MasterGroup.MainItem
Apr 2nd, 2020 at 9:44am
Print Post  
I have reduced the picture to a point where it cannot be reduced anymore. Double-clicking on any point of the picture does not move properly to the middle of the view. What changes do I need to make?

private void diagram_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
        {
            var zoomRect = diagram.Viewport;
            if (e.Delta < 0)
                zoomRect.Inflate(100, 100);
            else
                zoomRect.Inflate(-100, -100);
            if (diagram.Bounds.Width >= zoomRect.Width && diagram.Bounds.Height >= zoomRect.Height)
                diagram.ZoomToRect(zoomRect, true);

            // stop the scrollviewer from scrolling
            e.Handled = true;
        }

private void diagram_NodeDoubleClicked(object sender, NodeEventArgs e)
        {
            var node = e.Node;

            if (node.MasterGroup != null)
                node = node.MasterGroup.MainItem as DiagramNode;

            var posX = e.MousePosition.X - (diagram.Viewport.X + diagram.Viewport.Width / 2);
            var posY = e.MousePosition.Y - (diagram.Viewport.Y + diagram.Viewport.Height / 2);

            diagram.ScrollX += posX;
            diagram.ScrollY += posY;
        }
  

4_2_4.png (Attachment deleted)
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: drag the node.MasterGroup.MainItem
Reply #1 - Apr 2nd, 2020 at 11:46am
Print Post  
Hi,

It doesn't move, because you're node is fixed at 0,0 as per your requirement from before and the diagram can't scroll anymore because you've reached the bounds of the diagram document. This is literally the same case as previously discussed here: https://mindfusion.eu/Forum/YaBB.pl?num=1585551644/5#5.

Regards,
Lyubo
MindFusion
  
Back to top
 
IP Logged
 
D
Full Member
***
Offline


I Love MindFusion!

Posts: 158
Joined: Mar 16th, 2020
Re: drag the node.MasterGroup.MainItem
Reply #2 - Apr 2nd, 2020 at 12:13pm
Print Post  
Thank you, Lyubo, I see Wink
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint