Profile Picture

NLineShape Not Properly Redrawing After an Undo?

Posted By Jason Irby 14 Years Ago
Author
Message
Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hi Jason,

Thank you for reporting this problem. This is indeed a bug in the diagram, which does not correctly update the shape dependencies when undoing. This problem is fixed in the latest service pack.


Best Regards,
Nevron Support Team



Jason Irby
Posted 14 Years Ago
View Quick Profile
Forum Member

Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 59, Visits: 77

 

I am running into an odd behavior that I have been able to reproduce in a simple example.

 

This example draws 2 squares and a circle and has 3 buttons.

Clicking button1 I create a connection between the circle and square1 and smartRefreshView.

Clicking button2 I modify the connection between the circle and square1 so it connects to square2 instead, and smartRefreshView.

Clicking button3 I perform an HistoryService Undo and smartRefreshView.

The expected behavior was that after clicking button3 the connector would be back to square1.  At first it doesn't appear to have worked.  The connector is still showing connected to square2. 

However, if you select the circle and move it a pixel or 2, the connector will suddenly redraw to show connected to square1 as it should. 

It appears the SmartRefresh did not succeed.  At the model level it appears the Undo succeeded but the NLineShape failed to redraw. 

Is there something I am missing here?  Is there a work around?

(See example code below....)

Thanks in advance for your time.

Jason Irby

 

using System;

using System.Windows.Forms;

using Nevron.Diagram;

using Nevron.Diagram.Shapes;

using Nevron.GraphicsCore;

namespace ConnectorExample

{

public partial class Form1 : Form

{

NDrawingDocument drawingDoc = new NDrawingDocument();

private NShape square1;

private NShape square2;

private NShape circle;

private NLineShape edge;

public Form1()

{

InitializeComponent();

this.nDrawingView1.Document = this.drawingDoc;

}

private void Form1_Load(object sender, EventArgs e)

{

NBasicShapesFactory f = new NBasicShapesFactory(drawingDoc);

f.DefaultSize = new NSizeF(100, 100);

square1 = f.CreateShape(BasicShapes.Rectangle);

square1.Location = new NPointF(50, 50);

drawingDoc.ActiveLayer.AddChild(square1);

square2 = f.CreateShape(BasicShapes.Rectangle);

square2.Location = new NPointF(250, 50);

drawingDoc.ActiveLayer.AddChild(square2);

circle = f.CreateShape(BasicShapes.Circle);

drawingDoc.ActiveLayer.AddChild(circle);

circle.Location = new NPointF(200, 200);

}

private void button1_Click(object sender, EventArgs e)

{

this.drawingDoc.HistoryService.StartTransaction("connectSq1");

this.edge = new NLineShape();

this.drawingDoc.ActiveLayer.AddChild(edge);

this.edge.ToShape = this.circle;

this.edge.FromShape = this.square1;

this.drawingDoc.HistoryService.Commit();

this.drawingDoc.SmartRefreshAllViews();

}

private void button2_Click(object sender, EventArgs e)

{

this.drawingDoc.HistoryService.StartTransaction("connectSq2");

this.edge.FromShape = this.square2;

this.drawingDoc.HistoryService.Commit();

this.drawingDoc.SmartRefreshAllViews();

}

private void button3_Click(object sender, EventArgs e)

{

this.drawingDoc.HistoryService.Undo();

this.drawingDoc.SmartRefreshAllViews();

}

}

}

 

 

 





Similar Topics


Reading This Topic