mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-11 18:04:27 +08:00
impr(result): display input history heatmap in the selected speed unit (ridemountainpig) (#4542)
This commit is contained in:
parent
9b65a314b9
commit
9f987a613a
2 changed files with 10 additions and 1 deletions
|
|
@ -888,6 +888,7 @@ ConfigEvent.subscribe(async (eventKey) => {
|
|||
updateWpmAndAcc();
|
||||
await updateGraph();
|
||||
await updateGraphPBLine();
|
||||
TestUI.applyBurstHeatmap();
|
||||
|
||||
((ChartController.result.options as PluginChartOptions<"line" | "scatter">)
|
||||
.plugins.annotation.annotations as AnnotationOptions<"line">[]) =
|
||||
|
|
|
|||
|
|
@ -1080,6 +1080,11 @@ export async function applyBurstHeatmap(): Promise<void> {
|
|||
burstlist = burstlist.filter((x) => x !== Infinity);
|
||||
burstlist = burstlist.filter((x) => x < 350);
|
||||
|
||||
const typingSpeedUnit = getTypingSpeedUnit(Config.typingSpeedUnit);
|
||||
burstlist.forEach((burst, index) => {
|
||||
burstlist[index] = Math.round(typingSpeedUnit.fromWpm(burst));
|
||||
});
|
||||
|
||||
if (
|
||||
TestInput.input.getHistory(TestInput.input.getHistory().length - 1)
|
||||
?.length !== TestWords.words.getCurrent()?.length
|
||||
|
|
@ -1165,7 +1170,10 @@ export async function applyBurstHeatmap(): Promise<void> {
|
|||
if (wordBurstAttr === undefined) {
|
||||
$(word).css("color", unreachedColor);
|
||||
} else {
|
||||
const wordBurstVal = parseInt(<string>wordBurstAttr);
|
||||
let wordBurstVal = parseInt(wordBurstAttr as string);
|
||||
wordBurstVal = Math.round(
|
||||
getTypingSpeedUnit(Config.typingSpeedUnit).fromWpm(wordBurstVal)
|
||||
);
|
||||
steps.forEach((step) => {
|
||||
if (wordBurstVal >= step.val) {
|
||||
$(word).addClass("heatmapInherit");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue