diff --git a/CHANGELOG.md b/CHANGELOG.md index 62c4c09..28037f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/MLEM.Ui/Elements/Tooltip.cs b/MLEM.Ui/Elements/Tooltip.cs index be077c6..5cf2d0d 100644 --- a/MLEM.Ui/Elements/Tooltip.cs +++ b/MLEM.Ui/Elements/Tooltip.cs @@ -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)