Skip to content

Commit

Permalink
fix: add loading placeholder on upscale image
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLLspectre committed Jun 28, 2024
1 parent e6fe08e commit 4a553bb
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions package/Editor/UpscaleEditor/UpscaleEditorUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ private void DrawRightSection(Rect position)
EditorStyle.Button("Upscale Image", () =>
{
if (currentImage == null) return;
upscaledImages.Add(null);
imageDataUrl = CommonUtils.Texture2DToDataURL(currentImage);
if (imageData != null)
{
Expand Down Expand Up @@ -324,12 +325,21 @@ private void FetchUpscaledImage(string imgUrl)
Id = asset.asset.id,
Url = asset.asset.url,
};
upscaledImages.Insert(0, texture);
if (upscaledImages[0] == null)
{
upscaledImages[0] = texture;
}
else
{
upscaledImages.Insert(0, texture);
}
imageDataList.Insert(0, newImageData);
});
});
});
});
}, errorAction => {
upscaledImages.RemoveAt(0);
});
}
else
Expand All @@ -353,7 +363,14 @@ private void FetchUpscaledImage(string imgUrl)
Id = asset.asset.id,
Url = asset.asset.url,
};
upscaledImages.Insert(0, texture);
if (upscaledImages[0] == null)
{
upscaledImages[0] = texture;
}
else
{
upscaledImages.Insert(0, texture);
}
imageDataList.Insert(0, newImageData);
});
});
Expand Down

0 comments on commit 4a553bb

Please sign in to comment.