Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic DiagramLite ZoomToRect() (Read 4496 times)
integragreg
YaBB Newbies
*
Offline



Posts: 40
Location: Tennessee
Joined: Jan 26th, 2009
DiagramLite ZoomToRect()
Sep 10th, 2009 at 12:50pm
Print Post  
Stoyan,

Could you possibly post some code that shows how one would implement a ZoomToRect() method in DiagramLite? We want it to work the same way it does in WpfDiagram.

Thanks,

Greg
« Last Edit: Sep 10th, 2009 at 4:03pm by integragreg »  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: DiagramLite ZoomToRect()
Reply #1 - Sep 11th, 2009 at 6:03am
Print Post  
This version adds the Diagram.ZoomToRect method:
https://mindfusion.eu/_beta/diaglite_zoomtorect.zip

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



Posts: 40
Location: Tennessee
Joined: Jan 26th, 2009
Re: DiagramLite ZoomToRect()
Reply #2 - Sep 11th, 2009 at 3:01pm
Print Post  
Thanks for the quick response.

The zoom to rect feature works. But now, if we change the diagram behavior to "Modify" it does not show a selection rectangle and the following exception is thrown:

"Unhandled Error in Silverlight 2 Application Object reference not set to an instance of an object. at MindFusion.Diagramming.Silverlight.Selection.UpdateDrag(InteractionState ist)"...

The exception message seems odd to me because it says it's a Silverlight 2 application, and we're using Silverlight 3.

  
Back to top
WWW  
IP Logged
 
integragreg
YaBB Newbies
*
Offline



Posts: 40
Location: Tennessee
Joined: Jan 26th, 2009
Re: DiagramLite ZoomToRect()
Reply #3 - Sep 11th, 2009 at 4:55pm
Print Post  
Another issue worth noting is that if we zoom to rect and then zoom to rect again, it doesn't work correctly the second time. I assume this is because the current zoom factor is no longer 100.0, and we are building the rect from the mouse coordinates like so:

Code
Select All
protected override void OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs e)


{



base.OnMouseLeftButtonUp(e);






if(Keyboard.Modifiers == ModifierKeys.Control)



{




dragEnd = e.GetPosition(this);




Rect sel = new Rect(dragStart, dragEnd);




ZoomToRect(sel);



}


}

 

  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: DiagramLite ZoomToRect()
Reply #4 - Sep 13th, 2009 at 1:00pm
Print Post  
This version should fix the selection rectangle problem:
https://mindfusion.eu/_beta/diaglite_modifyfix.zip

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: DiagramLite ZoomToRect()
Reply #5 - Sep 13th, 2009 at 1:07pm
Print Post  
Regarding the mouse position issue, try setting dragStart and dragEnd to e.GetPosition(diagram.DocumentPlane).

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