ILPlotCube.Limits ! ILLimits plotcube. Changed. , .
private void ilPanel1_Load_1(object sender, EventArgs e) {
ILArray<float> A1 = new float[] { 1,4,3,2,5 };
var pc1 = ilPanel1.Scene.Add(new ILPlotCube("pc1") {
ScreenRect = new RectangleF(0,0,1,.6f)
});
ILArray<float> A2 = new float[] { -1,-4,-3,-2,4 };
var pc2 = ilPanel1.Scene.Add(new ILPlotCube("pc2") {
ScreenRect = new RectangleF(0, .4f, 1, .6f)
});
pc1.Add(new ILLinePlot(A1));
pc2.Add(new ILLinePlot(A2));
pc1 = ilPanel1.SceneSyncRoot.First<ILPlotCube>("pc1");
pc2 = ilPanel1.SceneSyncRoot.First<ILPlotCube>("pc2");
pc1.Limits.Changed += (_s, _a) => { SynchXAxis(pc1.Limits, pc2.Limits); };
pc2.Limits.Changed += (_s, _a) => { SynchXAxis(pc2.Limits, pc1.Limits); };
}
private void SynchXAxis(ILLimits lim1, ILLimits lim2) {
Vector3 min = lim2.Min;
Vector3 max = lim2.Max;
min.X = lim1.XMin; max.X = lim1.XMax;
lim2.EventingSuspend();
lim2.Set(min, max);
lim2.EventingStart();
}

, / , . X. .
1) , , , . ILPanel , , , . , . ILPanel.SceneSynchRoot .
2) When transferring changes from Limitsone plot cube to another, you need to disable the event on the target limits object. Otherwise, it will trigger another event Changed, and the events will fire indefinitely. The function ILLimits.EventingStart()repeats the event after the changes and cancels all the events accumulated so far.
source
share