Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic DocExtents not being updated. (Read 3418 times)
p.hannah
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 38
Joined: Feb 1st, 2006
DocExtents not being updated.
Mar 24th, 2006 at 1:36am
Print Post  
Hi,  I think I've found a couple of issues.

If objects are added to a flowchart (with autosizedoc=alldirections) the docextents aren't updated correctly (in the code attached, I'm looping over all visible boxes and arrows boudingboxes and trying to zoom to show just them.)

Also, when the subsequent zoomtorect is called where the docextents is incorrect due to the previous problem, and the zoomtorect rect is larger than the document, the following exception occurs:

System.ArgumentOutOfRangeException was unhandled
  Message="Value of '382' is not valid for 'Value'. 'Value' should be between 'minimum' and 'maximum'.\r\nParameter name: Value"
  Source="System.Windows.Forms"
  ParamName="Value"
  StackTrace:
      at System.Windows.Forms.ScrollBar.set_Value(Int32 value)
      at MindFusion.FlowChartX.FlowChart.resetScrollbars()
...

I would have thought another action other than an exception (perhaps if alldirections is set, then the docextents are extended.)

Thanks.

----------------

From visible objects:
minX = 400.0
minY = 0.0
width = 353.3059
height = 239.999985

ZoomToRect rect:
{X = 382.334717 Y = -11.999999
Width = 388.6365 Height = 264.0}

fcFlowChart.DocExtents:
{X = -14.5 Y = -19.05
Width = 311.5 Height = 229.05}

The code generating these values:
...
     foreach (Box box in fcFlowChart.Boxes)
     {
       if (box.Visible)
       {
         foundVisibleObject = true;
         if (box.BoundingRect.Left < minX)   minX = box.BoundingRect.Left;
         if (box.BoundingRect.Top < minY)    minY = box.BoundingRect.Top;
         if (box.BoundingRect.Right > maxX)  maxX = box.BoundingRect.Right;
         if (box.BoundingRect.Bottom > maxY) maxY = box.BoundingRect.Bottom;
       }
     }

     foreach (Arrow arrow in fcFlowChart.Arrows)
     {
       if (arrow.Visible)
       {
         foundVisibleObject = true;
         if (arrow.BoundingRect.Left < minX)   minX = arrow.BoundingRect.Left;
         if (arrow.BoundingRect.Top < minY)    minY = arrow.BoundingRect.Top;
         if (arrow.BoundingRect.Right > maxX)  maxX = arrow.BoundingRect.Right;
         if (arrow.BoundingRect.Bottom > maxY) maxY = arrow.BoundingRect.Bottom;
       }
     }

     float width = maxX - minX;
     float height = maxY - minY;

     if (foundVisibleObject)
       fcFlowChart.ZoomToRect(new RectangleF(minX - width * 0.05F, minY - height * 0.05F, width * 1.1F, height * 1.1F));
...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: DocExtents not being updated.
Reply #1 - Mar 24th, 2006 at 5:12am
Print Post  
Hi,

Are those objects added via the API or drawn with the mouse ? AutoSizeDoc is considered only for users actions, e.g. when the users move, create or delete nodes. The document is never resized automatically after programmatic actions. You could use FitDocToObjects to set the doc. size after creating all objects.

We'll check why ZoomToRect throws an exception.

Stoyan
  
Back to top
 
IP Logged
 
p.hannah
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 38
Joined: Feb 1st, 2006
Re: DocExtents not being updated.
Reply #2 - Mar 27th, 2006 at 3:36am
Print Post  
Thanks,

They are drawn with the API, so I've included a routine to update the docextents manually.

Paul.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint