mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
Fix: reload times show one decimal from a shared constant
The reload visualizer and the Firepower reload rows showed two decimals. Add an exported `RELOAD_PRECISION` (1) in the reload visualizer and use it for the visualizer's times and placeholders and for the Firepower reload rows (per-shell reloads, reload and intra-clip).
This commit is contained in:
1 parent
f3e8cdd5e0
commit
2e46ba79cf
2 files changed
+11
-11
No files matched your search
+4
-4
@@ -17,7 +17,7 @@ import { AssaultRangesVisualizer } from "./AssaultRangesVisualizer";
|
|||||||
import { GunFlexibilityVisualizer } from "./GunFlexibilityVisualizer";
|
import { GunFlexibilityVisualizer } from "./GunFlexibilityVisualizer";
|
||||||
import { Info } from "./Info";
|
import { Info } from "./Info";
|
||||||
import { InfoWithDelta } from "./InfoWithDelta";
|
import { InfoWithDelta } from "./InfoWithDelta";
|
||||||
import { ReloadVisualizer } from "./ReloadVisualizer";
|
import { RELOAD_PRECISION, ReloadVisualizer } from "./ReloadVisualizer";
|
||||||
import { RicochetVisualizer } from "./RicochetVisualizer";
|
import { RicochetVisualizer } from "./RicochetVisualizer";
|
||||||
import { StatsTableWrapper } from "./StatsTableWrapper";
|
import { StatsTableWrapper } from "./StatsTableWrapper";
|
||||||
import type { StatsAcceptorProps } from "./TraverseVisualizer";
|
import type { StatsAcceptorProps } from "./TraverseVisualizer";
|
||||||
@@ -163,7 +163,7 @@ export function Firepower({
|
|||||||
.shell_index,
|
.shell_index,
|
||||||
{ index: index + 1 },
|
{ index: index + 1 },
|
||||||
)}
|
)}
|
||||||
decimals={2}
|
decimals={RELOAD_PRECISION}
|
||||||
deltaType="lowerIsBetter"
|
deltaType="lowerIsBetter"
|
||||||
noRanking
|
noRanking
|
||||||
value={() => reload}
|
value={() => reload}
|
||||||
@@ -173,7 +173,7 @@ export function Firepower({
|
|||||||
) : (
|
) : (
|
||||||
<InfoWithDelta
|
<InfoWithDelta
|
||||||
stats={stats}
|
stats={stats}
|
||||||
decimals={2}
|
decimals={RELOAD_PRECISION}
|
||||||
deltaType="lowerIsBetter"
|
deltaType="lowerIsBetter"
|
||||||
value="shellReload"
|
value="shellReload"
|
||||||
/>
|
/>
|
||||||
@@ -183,7 +183,7 @@ export function Firepower({
|
|||||||
<InfoWithDelta
|
<InfoWithDelta
|
||||||
stats={stats}
|
stats={stats}
|
||||||
indent
|
indent
|
||||||
decimals={2}
|
decimals={RELOAD_PRECISION}
|
||||||
deltaType="lowerIsBetter"
|
deltaType="lowerIsBetter"
|
||||||
value="intraClip"
|
value="intraClip"
|
||||||
/>
|
/>
|
||||||
|
|||||||
+7
-7
@@ -11,7 +11,7 @@ import { Shell } from './components/Shell';
|
|||||||
import { Target } from './components/Target';
|
import { Target } from './components/Target';
|
||||||
import './index.css';
|
import './index.css';
|
||||||
|
|
||||||
const PRECISION = 2;
|
export const RELOAD_PRECISION = 1;
|
||||||
|
|
||||||
export interface ReloadUpdateData {
|
export interface ReloadUpdateData {
|
||||||
reload: number;
|
reload: number;
|
||||||
@@ -82,9 +82,9 @@ export function ReloadVisualizer({ stats }: StatsAcceptorProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
totalTime.current.innerHTML = shellReload.toFixed(PRECISION);
|
totalTime.current.innerHTML = shellReload.toFixed(RELOAD_PRECISION);
|
||||||
progressTime.current.innerHTML = ((1 - reload) * shellReload).toFixed(
|
progressTime.current.innerHTML = ((1 - reload) * shellReload).toFixed(
|
||||||
PRECISION,
|
RELOAD_PRECISION,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (state.current >= reloadThreshold) shoot();
|
if (state.current >= reloadThreshold) shoot();
|
||||||
@@ -117,9 +117,9 @@ export function ReloadVisualizer({ stats }: StatsAcceptorProps) {
|
|||||||
shells = times(stats.shells, (index) => index > state.current - 1);
|
shells = times(stats.shells, (index) => index > state.current - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
totalTime.current.innerHTML = interval.toFixed(PRECISION);
|
totalTime.current.innerHTML = interval.toFixed(RELOAD_PRECISION);
|
||||||
progressTime.current.innerHTML = ((1 - reload) * interval).toFixed(
|
progressTime.current.innerHTML = ((1 - reload) * interval).toFixed(
|
||||||
PRECISION,
|
RELOAD_PRECISION,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (lastState % 1 > state.current % 1) shoot();
|
if (lastState % 1 > state.current % 1) shoot();
|
||||||
@@ -262,7 +262,7 @@ export function ReloadVisualizer({ stats }: StatsAcceptorProps) {
|
|||||||
transform: 'translate(50%, -50%)',
|
transform: 'translate(50%, -50%)',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
0.00
|
{(0).toFixed(RELOAD_PRECISION)}
|
||||||
</Code>
|
</Code>
|
||||||
<Code
|
<Code
|
||||||
ref={totalTime}
|
ref={totalTime}
|
||||||
@@ -277,7 +277,7 @@ export function ReloadVisualizer({ stats }: StatsAcceptorProps) {
|
|||||||
transform: 'translate(-50%, -50%)',
|
transform: 'translate(-50%, -50%)',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
0.00
|
{(0).toFixed(RELOAD_PRECISION)}
|
||||||
</Code>
|
</Code>
|
||||||
|
|
||||||
{stats.shells > 1 &&
|
{stats.shells > 1 &&
|
||||||
|
|||||||
Reference in new issue
Block a user