mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-03 16:00:36 +01:00
yeah this is fine
This commit is contained in:
1 parent
e4b49e1600
commit
f4894655b0
2 files changed
+10
-6
No files matched your search
+5
-1
@@ -183,7 +183,11 @@ export const InfoWithDelta = memo<InfoWithDeltaProps>(
|
|||||||
size="1"
|
size="1"
|
||||||
value={goodness * 100}
|
value={goodness * 100}
|
||||||
color={color}
|
color={color}
|
||||||
style={{ height: "0.125rem", opacity: 0.5 }}
|
style={{
|
||||||
|
position: "relative",
|
||||||
|
height: "0.125rem",
|
||||||
|
opacity: 0.75,
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -1,7 +1,7 @@
|
|||||||
import { memo, useEffect, useMemo, useRef } from "react";
|
import { memo, useEffect, useMemo, useRef } from "react";
|
||||||
|
|
||||||
const RESOLUTION = 1000;
|
const RESOLUTION = 1000;
|
||||||
const HEIGHT = 9;
|
const HEIGHT = 8;
|
||||||
const DENSE_TICKS = 100;
|
const DENSE_TICKS = 100;
|
||||||
|
|
||||||
interface StatScaleProps {
|
interface StatScaleProps {
|
||||||
@@ -17,7 +17,7 @@ export const StatScale = memo<StatScaleProps>(
|
|||||||
const min = Math.min(value, ...values);
|
const min = Math.min(value, ...values);
|
||||||
const max = Math.max(value, ...values);
|
const max = Math.max(value, ...values);
|
||||||
const range = max - min;
|
const range = max - min;
|
||||||
const counts = new Map<number, number>();
|
const positions = new Set<number>();
|
||||||
|
|
||||||
for (const other of values) {
|
for (const other of values) {
|
||||||
const raw = range === 0 ? 0.5 : (other - min) / range;
|
const raw = range === 0 ? 0.5 : (other - min) / range;
|
||||||
@@ -25,10 +25,10 @@ export const StatScale = memo<StatScaleProps>(
|
|||||||
|
|
||||||
if (x === 0 || x === RESOLUTION) continue;
|
if (x === 0 || x === RESOLUTION) continue;
|
||||||
|
|
||||||
counts.set(x, (counts.get(x) ?? 0) + 1);
|
positions.add(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Array.from(counts, ([x, count]) => ({ x }));
|
return Array.from(positions, (x) => ({ x }));
|
||||||
}, [values, value, lowerIsBetter]);
|
}, [values, value, lowerIsBetter]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -54,7 +54,7 @@ export const StatScale = memo<StatScaleProps>(
|
|||||||
|
|
||||||
const styles = getComputedStyle(canvas);
|
const styles = getComputedStyle(canvas);
|
||||||
for (const { x } of ticks) {
|
for (const { x } of ticks) {
|
||||||
context.fillStyle = styles.getPropertyValue("--gray-a5").trim();
|
context.fillStyle = styles.getPropertyValue("--gray-a6").trim();
|
||||||
context.fillRect((x / RESOLUTION) * width, 0, 1, HEIGHT);
|
context.fillRect((x / RESOLUTION) * width, 0, 1, HEIGHT);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user