Skip to content

Commit 4141c4c

Browse files
committed
Allow probe to go outside of view
- Add a button that resets the zoom for the channel configuration dialog - Removed the Reset Zoom buttons from the Neuropixels device dialogs, as it is the same as the new one added to the base dialog - Leave the zoom in boundaries to the default, except for Rhs2116 where it is decreased
1 parent 0599a37 commit 4141c4c

9 files changed

+124
-175
lines changed

OpenEphys.Onix1.Design/ChannelConfigurationDialog.Designer.cs

Lines changed: 58 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OpenEphys.Onix1.Design/ChannelConfigurationDialog.cs

Lines changed: 10 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ internal virtual void ZoomEvent(ZedGraphControl sender, ZoomState oldState, Zoom
115115
}
116116
}
117117

118-
CheckProbeIsInView(sender);
119-
120118
if (IsDrawScale())
121119
SyncYAxes(zedGraphChannels.MasterPane.PaneList[0], zedGraphChannels.MasterPane.PaneList[1]);
122120
}
@@ -183,56 +181,6 @@ private void CenterAxesOnCursor(ZedGraphControl zedGraphControl)
183181
zedGraphControl.GraphPane.YAxis.Scale.Max += diffY;
184182
}
185183

186-
private static void CheckProbeIsInView(ZedGraphControl zedGraphControl)
187-
{
188-
var probe = (
189-
XMin: GetProbeLeft(zedGraphControl.GraphPane.GraphObjList),
190-
XMax: GetProbeRight(zedGraphControl.GraphPane.GraphObjList),
191-
YMin: GetProbeBottom(zedGraphControl.GraphPane.GraphObjList),
192-
YMax: GetProbeTop(zedGraphControl.GraphPane.GraphObjList)
193-
);
194-
195-
var axis = (
196-
XMin: zedGraphControl.GraphPane.XAxis.Scale.Min,
197-
XMax: zedGraphControl.GraphPane.XAxis.Scale.Max,
198-
YMin: zedGraphControl.GraphPane.YAxis.Scale.Min,
199-
YMax: zedGraphControl.GraphPane.YAxis.Scale.Max
200-
);
201-
202-
var pane = zedGraphControl.GraphPane;
203-
204-
static void EnsureVisible(ref double axisMin, ref double axisMax, double probeMin, double probeMax)
205-
{
206-
if (axisMin > probeMin && axisMax > probeMax)
207-
{
208-
double diffMin = Math.Abs(axisMin - probeMin);
209-
double diffMax = Math.Abs(axisMax - probeMax);
210-
211-
double shift = (axisMax - diffMin > probeMax) ? diffMin : diffMax;
212-
axisMin -= shift;
213-
axisMax -= shift;
214-
}
215-
else if (axisMax < probeMax && axisMin < probeMin)
216-
{
217-
double diffMin = Math.Abs(axisMin - probeMin);
218-
double diffMax = Math.Abs(axisMax - probeMax);
219-
220-
double shift = (axisMin + diffMax > probeMin) ? diffMin : diffMax;
221-
axisMin += shift;
222-
axisMax += shift;
223-
}
224-
}
225-
226-
EnsureVisible(ref axis.XMin, ref axis.XMax, probe.XMin, probe.XMax);
227-
EnsureVisible(ref axis.YMax, ref axis.YMin, probe.YMax, probe.YMin);
228-
229-
pane.XAxis.Scale.Min = axis.XMin;
230-
pane.XAxis.Scale.Max = axis.XMax;
231-
232-
pane.YAxis.Scale.Min = axis.YMin;
233-
pane.YAxis.Scale.Max = axis.YMax;
234-
}
235-
236184
internal static double CalculateScaleRange(Scale scale)
237185
{
238186
return scale.Max - scale.Min;
@@ -929,7 +877,6 @@ static void InitializeScalePane(GraphPane pane)
929877

930878
pane.YAxis.Scale.IsPreventLabelOverlap = true;
931879
pane.YAxis.Scale.MajorStep = 100;
932-
pane.YAxis.Scale.BaseTic = 0;
933880
pane.YAxis.Scale.IsLabelsInside = true;
934881
pane.YAxis.Scale.FontSpec.Size = 65f;
935882
pane.YAxis.Scale.FontSpec.IsBold = false;
@@ -1196,8 +1143,6 @@ private bool MouseMoveEvent(ZedGraphControl sender, MouseEventArgs e)
11961143
if (IsDrawScale())
11971144
SyncYAxes(zedGraphChannels.MasterPane.PaneList[0], zedGraphChannels.MasterPane.PaneList[1]);
11981145

1199-
CheckProbeIsInView(sender);
1200-
12011146
return false;
12021147
}
12031148
else if (e.Button == MouseButtons.None)
@@ -1366,5 +1311,15 @@ internal static bool HasContactAnnotations(ProbeGroup probeGroup)
13661311

13671312
return false;
13681313
}
1314+
1315+
private void ButtonResetZoom_Click(object sender, EventArgs e)
1316+
{
1317+
ResetZoom();
1318+
1319+
if (IsDrawScale())
1320+
SyncYAxes(zedGraphChannels.MasterPane.PaneList[0], zedGraphChannels.MasterPane.PaneList[1]);
1321+
1322+
RefreshZedGraph();
1323+
}
13691324
}
13701325
}

OpenEphys.Onix1.Design/NeuropixelsV1ChannelConfigurationDialog.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ public NeuropixelsV1ChannelConfigurationDialog(NeuropixelsV1ProbeConfiguration p
3939

4040
ProbeConfiguration = probeConfiguration;
4141

42-
ZoomInBoundaryX = 200;
43-
ZoomInBoundaryY = 200;
44-
4542
HighlightEnabledContacts();
4643
UpdateContactLabels();
4744
DrawScale();

0 commit comments

Comments
 (0)