Skip to content

Commit

Permalink
Improve show detail and close detail performance.
Browse files Browse the repository at this point in the history
  • Loading branch information
charles7668 committed Dec 14, 2024
1 parent aa60e12 commit 6a7995f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
6 changes: 1 addition & 5 deletions GameManager/Components/Pages/Home.Razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -491,22 +491,18 @@ private Task OnShowDetail(int id)
{
IsShowDetail = true;
_showDetailId = id;
_ = InvokeAsync(StateHasChanged);
return Task.CompletedTask;
}

private async Task OnCloseDetail()
{
IsShowDetail = false;
await JsRuntime.InvokeVoidAsync("enableHtmlOverflow");
GameInfoDTO? updateItem = await ConfigService.GetGameInfoBaseDTOAsync(_showDetailId);
ViewInfo? viewInfo = ViewGameInfos.Find(x => x.Info.Id == _showDetailId);
if (updateItem != null && viewInfo != null)
{
viewInfo.Info = updateItem;
}

_ = InvokeAsync(StateHasChanged);
IsShowDetail = false;
}

private async Task OnEnableSyncClick()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ private Task RefreshData(GameInfoDTO? inputGameInfo = null)
try
{
Logger.LogInformation("start loading game info");
_ = JsRuntime.InvokeVoidAsync("disableHtmlOverflow");
GameInfoDTO gameInfo = inputGameInfo ??
await ConfigService.GetGameInfoDTOAsync(x => x.Id == InitGameId,
q => q.Include(x => x.LaunchOption)) ??
Expand Down
12 changes: 0 additions & 12 deletions GameManager/wwwroot/js/webview_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,4 @@ function getCardListWidth() {

function remToPixels(rem) {
return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
}

function disableHtmlOverflow(){
window.scrollTo({
top: 0,
behavior: 'instant'
})
document.querySelector("html").classList.add("overflow-y-hidden");
}

function enableHtmlOverflow(){
document.querySelector("html").classList.remove("overflow-y-hidden");
}

0 comments on commit 6a7995f

Please sign in to comment.