Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) Require custom handle (Read 6659 times)
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Require custom handle
Oct 11th, 2009 at 1:39pm
Print Post  
Hi Stoyan,

For ShapeNode in my application, I want custom implemetation for handle style.

I want HandleStyle= HandleStyle.Custom with EnableHandles=AdjustmentHandles.Move | AdjustmentHandles.ResizeHandles;

so that I can resize the node as well as moving.

Please suggest for this.


Regards,
Anshul
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Require custom handle
Reply #1 - Oct 12th, 2009 at 11:53am
Print Post  
Hi Stoyan,

Any update on this? Please suggest your valuable suggestion for this problem. I have tried a lot but not got any work around. I am unable to make node resizable along with custom handle.

Regards,
Anshul
« Last Edit: Oct 12th, 2009 at 7:00pm by Anshul »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Require custom handle
Reply #2 - Oct 13th, 2009 at 7:02am
Print Post  
You can reuse the built-in hit testing functionality, similar to what you did for the drawing code. In the HitTestAdjustmentHandles handler switch the HandlesStyle temporarily to one close to what you need, call the node.HitTestHandle method and assign the returned handle index to e.HitResult.
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Require custom handle
Reply #3 - Oct 13th, 2009 at 2:52pm
Print Post  
Hi Stoyan,

I have tried but not able to solve this issue. Could you please suggest something using some snippet?


Regards,
Anshul
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Require custom handle
Reply #4 - Oct 14th, 2009 at 12:43pm
Print Post  
Hi Stoyo,

Any update on this. This is an urgent requirement so please suggest us.

Regards,
Anshul
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Require custom handle
Reply #5 - Oct 14th, 2009 at 1:26pm
Print Post  
"I want custom implementation for handle style" doesn't tell me much what this custom implementation should do. If you want to reuse some of the built-in hit testing, try this:

Code
Select All
private void diagram_HitTestAdjustmentHandles(object sender, HitTestEventArgs e)
{
	var node = e.Item as DiagramNode;
	if (node != null)
	{
		node.HandlesStyle = HandlesStyle.SquareHandles;
		int handle = -1;
		if (node.HitTestHandle(e.MousePosition, ref handle))
			e.HitResult = handle;
		node.HandlesStyle = HandlesStyle.Custom;
	}
}
 

  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Require custom handle
Reply #6 - Oct 14th, 2009 at 1:36pm
Print Post  
Hi Stoyan,

I have done with the Custom Handle Style. I am getting Custom Handle but problem is that  I Want EnableHandles=AdjustmentHandles.Move | AdjustmentHandles.ResizeHandles; with this custom Handle so that I can resize the node as well as move the node.

Please suggest somthing on this. How can I have both EnableHandles Style?

Regards,
Anshul
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Require custom handle
Reply #7 - Oct 14th, 2009 at 1:45pm
Print Post  
I cannot understand what you want. EnabledHandles has that value by default. If you call the HitTestHandle method, it will check which bits in EnabledHandles are disabled, and will not return handles corresponding to the disabled ones.
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Require custom handle
Reply #8 - Oct 15th, 2009 at 6:23am
Print Post  
Hi Stoyan,

I have sent a sample at your support ID please look into that.

I have applied my custom handle style in that.

Now I want AdjustmentHandle as ResizeHandle && Move with this custom implemetation.

Please suggest.

Regards,
Anshul
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Require custom handle
Reply #9 - Oct 15th, 2009 at 9:55am
Print Post  
How exactly do you want it different from the default implementation? If you want to allow moving from anywhere in the node interior, change the handler above to this:

Code
Select All
private void diagram_HitTestAdjustmentHandles(object sender, MindFusion.Diagramming.Wpf.HitTestEventArgs e)
{
	var node = e.Item as DiagramNode;
	if (node != null)
	{
		node.HandlesStyle = HandlesStyle.SquareHandles;
		int handle = -1;
		if (node.HitTestHandle(e.MousePosition, ref handle))
			e.HitResult = handle;
		node.HandlesStyle = HandlesStyle.Custom;
		if (handle < 8 && node.Bounds.Contains(e.MousePosition))
			e.HitResult = 8;
	}
}
 

  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Require custom handle
Reply #10 - Oct 15th, 2009 at 3:39pm
Print Post  
Hi Stoyan,

Thanks for your valuable suggestion. It is the same as I was expecting.

One more issue is their, I have locked that node now I want nobody can move it from its place but he/she can resize it. I have tried to do this in NodeStartModifying method but not getting expected behavior. Could you please suggest what could I do to get such kind of behavior ?

Regards,
Anshul
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Require custom handle
Reply #11 - Oct 16th, 2009 at 5:31am
Print Post  
Hi,

Set EnabledHandles = ResizeHandles for such nodes, and in your custom hit testing implementation don't set HitResult to the move handle (8) if the AdjustmentHandles.Move bit is not set.

Stoyan
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Require custom handle
Reply #12 - Oct 16th, 2009 at 6:38am
Print Post  
Sorry stoyan, but not able to do this. Could you please explain in detail?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Require custom handle
Reply #13 - Oct 19th, 2009 at 6:32am
Print Post  
Set EnabledHandles = AdjustmentHandles.ResizeHandles for nodes that should only be resized, and add this to the end of the custom hit-test handler:

if ((node.EnabledHandles & AdjustmentHandles.Move) == 0 && e.HitResult == 8)
     e.HitResult = -1;

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


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Require custom handle
Reply #14 - Oct 21st, 2009 at 9:56am
Print Post  
Hi Stoyan,

I have already sent you the application sample regarding this.

Please suggest for this, as early as possible.

Regards,
Anshul
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint