Skip to content

Commit

Permalink
Try fix geometry limit problem
Browse files Browse the repository at this point in the history
  • Loading branch information
ROMaster2 committed Dec 12, 2018
1 parent ca3f515 commit 14b4cb4
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions UI/ScanRegionUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,15 @@ public Geometry NumGeometry
if (vGeo.IsBlank)
{
maxGeometry = new Geometry(8192, 8192, 8192, 8192);
minGeometry = new Geometry(-8192, -8192, 4, 4);
//minGeometry = new Geometry(-8192, -8192, 4, 4);
minGeometry = new Geometry(0, 0, 4, 4);
}
else
{
maxGeometry = new Geometry(vGeo.Width, vGeo.Height, vGeo.Width * 2, vGeo.Height * 2);
minGeometry = new Geometry(-vGeo.Width, -vGeo.Height, 4, 4);
//maxGeometry = new Geometry(vGeo.Width, vGeo.Height, vGeo.Width * 2, vGeo.Height * 2);
//minGeometry = new Geometry(-vGeo.Width, -vGeo.Height, 4, 4);
maxGeometry = new Geometry(vGeo.Width - 4, vGeo.Height - 4, vGeo.Width, vGeo.Height);
minGeometry = new Geometry(0, 0, 4, 4);
}

return new Geometry(
Expand Down Expand Up @@ -114,6 +117,12 @@ private void SetAllNumValues(Geometry geo)
UpdateCropGeometry();
}

private void ResetNumValues()
{
NumGeometry = (_VideoGeometry.Width < 8 || _VideoGeometry.Height < 8) ? new Geometry(640, 480) : _VideoGeometry;
UpdateCropGeometry();
}

// Validated triggers when the user manually changes the value, rather than anytime it changes.
private void numX_Validated(object sender, EventArgs e) => UpdateCropGeometry();
private void numY_Validated(object sender, EventArgs e) => UpdateCropGeometry();
Expand All @@ -122,7 +131,7 @@ private void SetAllNumValues(Geometry geo)

private void btnReset_Click(object sender, EventArgs e)
{
SetAllNumValues(_VideoGeometry);
ResetNumValues();
}

private void FillboxPreviewType()
Expand Down

0 comments on commit 14b4cb4

Please sign in to comment.