Skip to content

Commit

Permalink
fix: Handle scaling less than 100% on Wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Aug 31, 2021
1 parent 63e9cde commit 7937de6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public async Task When_Resource_Has_Scale_Qualifier()
{
var scales = new List<ResolutionScale>()
{
(ResolutionScale)80,
ResolutionScale.Scale100Percent,
ResolutionScale.Scale150Percent,
ResolutionScale.Scale200Percent,
Expand Down
8 changes: 8 additions & 0 deletions src/Uno.UI/UI/Xaml/Media/Imaging/BitmapImage.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ private static string GetScaledPath(string path, HashSet<string> assets, Resolut

var resolutionScale = scaleOverride == null ? (int)DisplayInformation.GetForCurrentView().ResolutionScale : (int)scaleOverride;

// On Windows, the minimum scale is 100%, however, on Wasm, we can have lower scales.
// This condition is to allow Wasm to use the .scale-100 image when the scale is < 100%
if (resolutionScale < 100)
{
resolutionScale = 100;
}


for (var i = KnownScales.Length - 1; i >= 0; i--)
{
var probeScale = KnownScales[i];
Expand Down

0 comments on commit 7937de6

Please sign in to comment.