Skip to content

Commit

Permalink
tastudio: don't let branch screenshot appear below screen edge
Browse files Browse the repository at this point in the history
  • Loading branch information
vadosnaprimer committed Dec 1, 2024
1 parent 28757bd commit 05f06ae
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void UpdateValues(
bb.DiscardAlpha();
_bitmap = bb.ToSysdrawingBitmap();
Width = width;
Padding = (int) measureString(captionText, Font, width).Height;
Padding = (int)measureString(captionText, Font, width).Height;
_drawingHeight = height;
Text = captionText;
Location = location;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
using System.IO;
using System.Linq;
using System.Windows.Forms;

using BizHawk.Client.Common;
using BizHawk.Emulation.Common;
using BizHawk.Client.EmuHawk.Properties;
using BizHawk.Common.CollectionExtensions;
using BizHawk.Emulation.Common;

namespace BizHawk.Client.EmuHawk
{
Expand Down Expand Up @@ -651,12 +652,25 @@ private void BranchView_PointedCellChanged(object sender, InputRoll.CellEventArg
var bb = branch.OSDFrameBuffer;
var width = bb.Width;
Point location = PointToScreen(Location);
var bottom = location.Y + bb.Height;
location.Offset(-width, 0);

if (location.X < 0)
{
// show on the right of branch control
location.Offset(width + Width, 0);
}

Math.Max(0, location.Y);
var screen = Screen.AllScreens.Where(s => s.WorkingArea.Contains(location)).FirstOrDefault();

Check failure on line 665 in src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs

View workflow job for this annotation

GitHub Actions / Build solution with analyzers

var h = screen.WorkingArea.Bottom - bottom;

if (h < 0)
{
// move up to become fully visible
location.Y += h;
}

_screenshot.UpdateValues(
bb,
branch.UserText,
Expand Down

0 comments on commit 05f06ae

Please sign in to comment.