Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ZoomToRect calls with an overview: OutOfMemory (Read 2583 times)
alexbisson
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: May 20th, 2010
ZoomToRect calls with an overview: OutOfMemory
May 31st, 2010 at 3:53pm
Print Post  
Hi,

I get OutOfMemory exceptions when I call the Diagram.ZoomToRect() method when an Overview is used.

Sample project to reproduce my behavior:

Markup:
Code
Select All
<Grid x:Name="LayoutRoot" Background="White">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"></ColumnDefinition>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
        </Grid.ColumnDefinitions>

        <diag:Diagram x:Name="diagram" Grid.Column="0"
                      Bounds="0, 0, 800, 800"
                      BackBrush="LightSteelBlue"
                      NodeDoubleClicked="diagram_NodeDoubleClicked"/>

        <StackPanel Orientation="Vertical" Grid.Column="1" >
            <diag:NodeListView x:Name="nodeListView"  />
            <diag:Overview x:Name="diagOverview"></diag:Overview>
            <Button Content="Default zoom" Click="Button_Click" />
        </StackPanel>
    </Grid>
 



Code behind:

Code
Select All
public MainPage()
        {
            InitializeComponent();
            nodeListView.Items.Add(new ShapeNode() { Text = "Node 1" });
            nodeListView.Items.Add(new ShapeNode { Text = "Node 2" });

            diagOverview.Document = diagram;
        }

        private void diagram_NodeDoubleClicked(object sender, NodeEventArgs e)
        {
            diagram.ZoomToRect(e.Node.Bounds);
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            diagram.ZoomFactor = 100;
        }
 



If a double-click on a node then click "Default zoom" several times, the memory usage jumps, eventually throwing an OutOfMemory Exception from the Overview.Update() method.

Everything works fine if I comment the following line in the constructor:
Code
Select All
diagOverview.Document = diagram; 



Thank you!

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ZoomToRect calls with an overview: OutOfMemory
Reply #1 - May 31st, 2010 at 5:11pm
Print Post  
Hi,

Yes, we were able to reproduce this. The overview creates a new WriteableBitmap(diagram) at one point and it gets too big when ZoomFactor is a large number. We'll try creating a smaller image using the WriteableBitmap(diagram, ScaleTransform) constructor to see if that will help.

Stoyan
  
Back to top
 
IP Logged
 
alexbisson
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: May 20th, 2010
Re: ZoomToRect calls with an overview: OutOfMemory
Reply #2 - May 31st, 2010 at 6:36pm
Print Post  
Will it be fixed in the next version? If so, what's the expected release date?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ZoomToRect calls with an overview: OutOfMemory
Reply #3 - Jun 1st, 2010 at 4:31pm
Print Post  
This version should fix that:
https://mindfusion.eu/_beta/diaglite16_ovw.zip

We should release it next week.
  
Back to top
 
IP Logged
 
alexbisson
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: May 20th, 2010
Re: ZoomToRect calls with an overview: OutOfMemory
Reply #4 - Jun 2nd, 2010 at 6:18pm
Print Post  
Thank you!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint