1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 04:53:29 +01:00

Fixed tooltips not being bounded correctly for viewports that don't start at the origin

This commit is contained in:
Ell 2024-10-08 18:12:22 +02:00
parent d2774ad7d2
commit 3bc5c7f18c
2 changed files with 7 additions and 4 deletions

View file

@ -28,6 +28,9 @@ Additions
- Added TextField.OnEnterPressed event
- Added Tooltip.IgnoreViewport and allow overriding the default viewport using Tooltip.Viewport
Fixes
- Fixed tooltips not being bounded correctly for viewports that don't start at the origin
## 7.1.1
### MLEM

View file

@ -226,10 +226,10 @@ namespace MLEM.Ui.Elements {
if (!this.IgnoreViewport) {
var view = this.Viewport ?? this.System.Viewport;
if (snap.X < view.X)
snap.X = view.X;
if (snap.Y < view.Y)
snap.Y = view.Y;
if (snap.X * this.Scale < view.X)
snap.X = view.X / this.Scale;
if (snap.Y * this.Scale < view.Y)
snap.Y = view.Y / this.Scale;
if (snap.X * this.Scale + this.Area.Width >= view.Right)
snap.X = (view.Right - this.Area.Width) / this.Scale;
if (snap.Y * this.Scale + this.Area.Height >= view.Bottom)