Skip to content

Commit

Permalink
Fix negative values in OverlayBase
Browse files Browse the repository at this point in the history
  • Loading branch information
C1rdec committed Apr 11, 2023
1 parent ee990a6 commit 10051cf
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/Lurker.UI/ViewModels/PoeOverlayBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public PoeOverlayBase(IWindowManager windowManager, DockingHelper dockingHelper,
/// <returns>The scaled value.</returns>
protected double ApplyScalingX(double value)
{
return value / this._scaleX;
return Scale(value, this._scaleX);
}

/// <summary>
Expand All @@ -126,7 +126,7 @@ protected double ApplyScalingX(double value)
/// <returns>The scaled value.</returns>
protected double ApplyScalingY(double value)
{
return value / this._scaleY;
return Scale(value, this._scaleY);
}

/// <summary>
Expand Down Expand Up @@ -175,6 +175,23 @@ protected async void HideView(int time)
this.ShowView();
}

/// <summary>
/// Scale the value.
/// </summary>
/// <param name="value">The value to scale.</param>
/// <param name="scale">The scale factor</param>
/// <returns>The scaled value.</returns>
private static double Scale(double value, double scale)
{
var scaledValue = value / scale;
if (scaledValue < 0)
{
return 0;
}

return scaledValue;
}

/// <summary>
/// Dockings the helper on foreground change.
/// </summary>
Expand Down

0 comments on commit 10051cf

Please sign in to comment.