Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic container and z order nodes inside. (Read 2459 times)
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
container and z order nodes inside.
Mar 27th, 2012 at 9:03pm
Print Post  
I need some method for make if some user select container only, and
move z order, all nodes inside container, move following the container z order.

Right now that not happen.
The only way to move all objcts follwing the z order level of container is
select all. (container + inside container nodes)

Exist some method for make nodes inside follow the z order of container?

Select all nodes +container is ok, but cause confusion to users.

At same time, if i move node inside container, when move that node to -
zorder (downlevel), in some moment, the node go out of container and is
moved to more lower z order level of container.
That make node go out of container.

Should be suposed the nodes inside a container cant or never should  reach
more lower order of the container for prevent that happen.
Is possible fix all this with some code?

Best regards.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: container and z order nodes inside.
Reply #1 - Mar 28th, 2012 at 11:28am
Print Post  
Try this method:

Code
Select All
void SetZ(DiagramItem item, int z)
{
	item.ZIndex = z;

	var ctr = item as ContainerNode;
	if (ctr != null && ctr.SubordinateGroup != null)
	{
		foreach (DiagramNode child in ctr.SubordinateGroup.AttachedNodes)
			child.ZIndex = ctr.ZIndex + 1;
	}
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: container and z order nodes inside.
Reply #2 - Mar 28th, 2012 at 8:40pm
Print Post  
Thankyou this work ok , anyway i continue with a ugly problem.
If form some reason user select single object or multiple inside of container, and move by accident node to down zorder (-z order)
The object/s is hidden an disaper.
You have to chose container and move z order for fix.

How can prevent object inside of node be moded under z order of container?

The same situation happen if user select contaner and all objects inside.

Objects inside container, never should go to more lower z order of container z order level and i think that should be a feature.

How can prevent this happen?



void SetZdown(DiagramItem item)
{
item.ZBottom();
var ctr = item as ContainerNode;
if (ctr != null && ctr.SubordinateGroup != null)
{
foreach (DiagramNode child in ctr.SubordinateGroup.AttachedNodes)
child.ZLevelUp();
}
}

void SetZup(DiagramItem item)
{
item.ZTop();
var ctr = item as ContainerNode;
if (ctr != null && ctr.SubordinateGroup != null)
{
foreach (DiagramNode child in ctr.SubordinateGroup.AttachedNodes)
child.ZTop();
}
}



for move down to bottom leevel
foreach (DiagramItem item in form.Selection.Items)
SetZdown(item);

for move up to top level
foreach (DiagramItem item in form.Selection.Items)
SetZup(item);


This is working now how i like, but nodes inside container can be moved to lower level and i need prevent that.



« Last Edit: Mar 28th, 2012 at 10:18pm by PDM. »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: container and z order nodes inside.
Reply #3 - Mar 29th, 2012 at 5:55am
Print Post  
Do not call ZBottom but use the parent container's ZIndex as a lower bpundary of the child's ZIndex. I.e. replace item.ZBottom() with this:

var parent = ContainerNode.GetContainer(item as DiagramNode);
item.ZIndex = parent == null ? 0 : parent.ZIndex + 1;

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint