Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic KeepInsideParent  with rounded rectangle node (Read 1874 times)
Cornel
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Dec 17th, 2008
KeepInsideParent  with rounded rectangle node
Jan 26th, 2010 at 11:01am
Print Post  
Hi,
I have a rounded rectangle node with a child node (rectangle) attached to it.
The child has KeepInsideParent = true. Still it is displayed partially outside because of the rounded corners of its parent.
How can I solve this (the child stay inside its parent also at corners)?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: KeepInsideParent  with rounded rectangle node
Reply #1 - Jan 26th, 2010 at 12:43pm
Print Post  
Hi,

KeepInsideParent only checks the nodes bounding rectangles, but not their geometries. You could call parent.GetOutlinePoly from the NodeModifying handler, check if any of the returned points is inside the child's rectangle and set e.Cancel=true in such case.

Regards,
Stoyan
  
Back to top
 
IP Logged
 
Cornel
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Dec 17th, 2008
Re: KeepInsideParent  with rounded rectangle node
Reply #2 - Jan 28th, 2010 at 7:34am
Print Post  
Hi Stoyan,
Ok.
But using e.Cancel will not stop the movement of the child node as far as I saw; only the mouse cursor changes.
What I need is the same functionality as KeepInsideParent (child moves inside parent following the mouse and when the mouse is outside parent's boundary the child is still moving on x or y axis), but following the parent's outline.
I am not using event handlers, I have a class inherited from ShapeNode, where I overide NodeModifying. Can you give some examples about how should I change the default functionality using NodeModifying?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: KeepInsideParent  with rounded rectangle node
Reply #3 - Jan 28th, 2010 at 10:00am
Print Post  
Hi Corneliu,

Yes, that will only show the stop cursor to indicate the dropping there will cancel the modification. If you are using a derived class, try to override UpdateModify, save the Bounds value before calling the base method and restore it afterwards you detect the child intersects with the rounded corner.

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