tastudio: don't let branch screenshot appear below screen edge

This commit is contained in:
feos 2024-12-01 21:58:50 +03:00
parent 28757bd8be
commit 05f06aeb5b
2 changed files with 16 additions and 2 deletions

View File

@ -82,7 +82,7 @@ namespace BizHawk.Client.EmuHawk
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;

View File

@ -3,10 +3,11 @@ using System.Drawing;
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
{
@ -651,12 +652,25 @@ namespace BizHawk.Client.EmuHawk
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();
var h = screen.WorkingArea.Bottom - bottom;
if (h < 0)
{
// move up to become fully visible
location.Y += h;
}
_screenshot.UpdateValues(
bb,
branch.UserText,