Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic drag drop transition effect (Read 2798 times)
zoozoo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Jun 24th, 2009
drag drop transition effect
Jul 2nd, 2009 at 9:05am
Print Post  
hi,

i am trying to add a transition effect ( sliding node effect ) in a tree layout diagram.

the code i am using is as belows

Point p = e.GetPosition(diagram );
           DiagramNode node = diagram.GetNodeAt(p);
           if (draggedcontrol != null)
           {

               p.X -= draggedcontrol.Width /2;
               p.Y -= draggedcontrol.Height/2;
               Canvas.SetLeft(draggedcontrol, p.X);
               Canvas.SetTop(draggedcontrol, p.Y);
               Canvas .SetLeft(node , p.X);
               Canvas.SetTop(node, p.Y );
               Layoutdiagram();
           }


in this in have 2 issues

1. the control is getting the moving efect but the host controlnode dosent move.

2. while moving the control should it be relative to diagram or the layoutroot because the above just shifts the control by a large difference.

any advice on this will be really helpful.

thanks in advance
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: drag drop transition effect
Reply #1 - Jul 2nd, 2009 at 12:07pm
Print Post  
Hi,

Is draggedControl hosted inside node? The ControlNode class contains a Canvas internally, so the first position you set is relative to the node in such a case. As for the node position, you should set node.Bounds instead of its attached Left/Top properties; the Bounds setter calls SetLeft and SetTop internally and updates some additional state variables.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
zoozoo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Jun 24th, 2009
Re: drag drop transition effect
Reply #2 - Jul 3rd, 2009 at 5:36am
Print Post  
yes. the controlnode is of a user control. so the draggedcontrol is inside a node.

can you please elaborate more. i am not arriving at any solution to this.
???
thanks for all the advice
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: drag drop transition effect
Reply #3 - Jul 3rd, 2009 at 9:33am
Print Post  
Could you give more details on what you are trying to implement? Why would you need to handle MouseMove and set the position of the hosted control independently from that of the host node?
  
Back to top
 
IP Logged
 
zoozoo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: Jun 24th, 2009
Re: drag drop transition effect
Reply #4 - Jul 4th, 2009 at 5:34pm
Print Post  
hi,

i am trying to move the node/control along with the mouse pointer when the user tries to drag the node.

just want to give the user the feel of moving the tree node

could you please help resolve this...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: drag drop transition effect
Reply #5 - Jul 5th, 2009 at 10:16am
Print Post  
Hi,

Are you trying to implement drag-and-drop from the diagram to another control? You should set only node.Bounds; this will also set the position of the hosted control.

If you need this for dragging nodes within the diagram, just use the built-in select and move functionality; check how it works with ModificationStart set to AutoHandles. In that case you can handle the drop operation using the NodeModified event.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint