Skip to content

Commit

Permalink
Merge pull request #787 from project-primera/develop
Browse files Browse the repository at this point in the history
Release 0.14.1
  • Loading branch information
slime-hatena committed Mar 7, 2024
2 parents d0a9146 + 9da42f3 commit 8821e2a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 21 deletions.
50 changes: 30 additions & 20 deletions OngekiScoreLog/resources/assets/js/userProgress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,30 @@ let images = progress.length;
let renderingState = 0;

async function convert(element: HTMLElement, index: number) {
let pr: Html2CanvasPromise<HTMLCanvasElement> = html2canvas(element, {
width: 640,
});

await pr.then(canvas => {
++renderingState
let base64 = canvas.toDataURL();

$('div#generate_images').append(
$("<img>").attr("src", base64)
);

$('.progress').val(renderingState / images * 100);
$(".progress-message").text("画像化中: " + renderingState + "/" + images + "(" + Math.round(renderingState / images * 100) + "%)");
try {
let pr: Html2CanvasPromise<HTMLCanvasElement> = html2canvas(element, {
width: 640,
});

await pr.then(canvas => {
++renderingState
let base64 = canvas.toDataURL();

$('div#generate_images').append(
$("<img>").attr("src", base64)
);

$('.progress').val(renderingState / images * 100);
$(".progress-message").text("画像化中: " + renderingState + "/" + images + "(" + Math.round(renderingState / images * 100) + "%)");

}).catch((res) => {
// $(".progress-message").text("エラーが発生しました。<br>" + JSON.stringify(res));
throw res;
});
} catch (error) {
// エラったらとりあえず無視 特定環境でたまに起きるらしい
}

}).catch((res) => {
$(".progress-message").text("エラーが発生しました。<br>" + JSON.stringify(res));
throw res;
});
}

$(function ($) {
Expand All @@ -43,10 +48,15 @@ $(function ($) {

for (let index = 0; index < progress.length; index++) {
const element: HTMLElement = <HTMLScriptElement>progress[index];

await convert(element, index);
}

$('.progress').removeClass("is-progress").removeAttr("value").removeAttr("max");
// 固定解除
$('html').css('overflow', 'visible');
$('body').css('overflow', 'visible');
document.addEventListener('touchmove', function (e) { /* */ }, { passive: false });

$(".progress-message").text("画像化完了! (" + renderingState + "枚)");
// $('.progress').removeClass("is-progress").removeAttr("value").removeAttr("max");
})
});
2 changes: 1 addition & 1 deletion OngekiScoreLog/resources/views/user_rating.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
</table>
</div>
<p>
<span class="subtitle is-5">到達可能レーティング: {{sprintf("%.2f",floor($statistics->maxRatingTotal / $statistics->totalRatingCount * 100) / 100)}}</span><br>
<span class="subtitle is-5">到達可能レーティング: {{sprintf("%.4f",floor($statistics->maxRatingTotal / $statistics->totalRatingCount * 10000) / 10000)}}</span><br>
現在のスコアデータのうち、最大レート({{$statistics->potentialRatingTop}})の曲でリーセント枠を全て埋めたときの値です。
@foreach ($messages as $message)
<p>
Expand Down

0 comments on commit 8821e2a

Please sign in to comment.