The beginning of multiple nodes dragging is slow

Hi,

I have a problem that when I dragged multiple nodes it takes some time until we see the temporary nodes that move with the mouse.

If I drag only one node it works just fine but the more nodes I drag together the more time it take until we see the temporary nodes.

I run a performance profiler and I saw that most of the time is spent at OnVisualParentChanged function.

Is there a way to fix or improve this?

See picture below

Thanks

Not that I know of. You could ask Microsoft exactly what happens during that time and why it takes so long.

But I’m curious about why it’s changing the node data Category in your FlowCanvasPartManager class. That’s causing the old Node visual tree to be removed and a new one created and added. Normally when a node data object is copied its properties are set but there’s nothing to be notified about the property changes, because the node data isn’t associated/data-bound with a Node yet. In this case it appears that the Category is being set after the Node already exists.

i checked this issues and i saw that i override the function

public override Northwoods.GoXam.Model.ICopyDictionary CopyParts(IEnumerable<Part> coll, Northwoods.GoXam.Model.IDiagramModel destmodel)
		{
			Northwoods.GoXam.Model.ICopyDictionary retVal = base.CopyParts(coll, destmodel);
		<SPAN style="COLOR: blue">foreach</SPAN> (TCanvasItemType canvasItem <SPAN style="COLOR: blue">in</SPAN> retVal.Copies.Nodes)
		{
			canvasItem.Category = <SPAN style="COLOR: #2b91af">NodeCategories</SPAN>.Dragged;
			canvasItem.Opacity = .5;
		}
		<SPAN style="COLOR: blue">return</SPAN> retVal;
	}</PRE><PRE style="FONT-FAMILY: Consolas; COLOR: black; FONT-SIZE: 13px; white: "> </PRE><PRE style="FONT-FAMILY: Consolas; COLOR: black; FONT-SIZE: 13px; white: "><P style="MARGIN: 0in 1.5pt 0pt; TEXT-AUTOSPACE: ideograph-numeric; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt; mso-layout-grid-align: auto" =Msonormal><SPAN style="FONT-FAMILY: Consolas; COLOR: black; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>So the dragged items will look different then the items on the canvas.<?: prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN><P style="MARGIN: 0in 1.5pt 0pt; TEXT-AUTOSPACE: ideograph-numeric; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt; mso-layout-grid-align: auto" =Msonormal><SPAN style="FONT-FAMILY: Consolas; COLOR: black; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>Is there a better way to do this?<o:p></o:p></SPAN><P style="MARGIN: 0in 1.5pt 0pt; TEXT-AUTOSPACE: ideograph-numeric; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt; mso-layout-grid-align: auto" =Msonormal><SPAN style="FONT-FAMILY: Consolas; COLOR: black; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>I saw that when we drag items we create a copy of them, is there a way not to copy the nodes/groups during the drag but just to keep the information of what I dragged and show a template of a single node/group or multi nodes during the drag?<o:p></o:p></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: black; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-: EN; mso-fareast-: EN-US; mso-bidi-: HE" lang=EN>this will speed up the drag and save memory consumptions.</SPAN></PRE></DIV>

What happens when you comment out that statement to change the Category?

it doesn’t help it is still slow.

But not changing the Category will avoid discarding all of those newly copied Parts and creating new ones using new templates. So it’s definitely faster than what you had before.

When the user copies, the DraggingTool has to make some kind of copy so that the original parts can remain where they were.

i don’t want to copy anything i want to move nodes from one place to another so i want a way not to copy at all intead just show some other templete during the drag.

when the user drop the drag then i will move or copy i don't want to do it during the drag.
is there a simple way for me to do it?
or do you have a sample of code that can help me?
or do i need to rewrite the entire dragging tool myself?

The default behavior (but not in your application?!) when the user drags a node is to move it – GoXam does not make any copies of the node. This is “realtime” dragging.

So are you trying to implement a move-dragging behavior where there is a temporary visual copy of the selection, and that upon a drop that temporary copy is discarded and the selected parts are moved to the intended point?

If so, I do not recall having any examples of how to implement that. You might be the first person to ask for it. One would need to override several methods of DraggingTool.

I change the code to work as I wanted.

I set a flag in the DoDragOut function that tell the part manager to override the CopyParts and "copy" only one node even if there are meny node selected, but now I have a problem with the drawing of the node.
Its working fine but when I get to the end of the screen and the auto scroll start the temp node is jumping.
You told me that after I update to version 1.2.8:
"If you turn off AllowDrop and AllowDragOut and enable copying without moving (without the control key being held down), you won’t see that jumpiness."
Can you tell me how setting this flags fixed the problem? so I will fix my code that update the node location and fix the jumpiness.
Thanks,

I noticed it in that test app that you sent me, since I wanted to try it both with Windows drag-and-drop and with just the internal mouse events.