Skip to content

heat map#38

Open
yoavs8 wants to merge 12 commits intomasterfrom
scouting/feat/heat-map
Open

heat map#38
yoavs8 wants to merge 12 commits intomasterfrom
scouting/feat/heat-map

Conversation

@yoavs8
Copy link
Contributor

@yoavs8 yoavs8 commented Feb 4, 2026

image

crazy vro👽👽👽👽

const clamped = Math.min(NORMALIZED_MAX, Math.max(NORMALIZED_MIN, value));
for (const [index, start] of COLOR_RAMP.slice(COLOR_RAMP_OFFSET, -RAMP_LAST_OFFSET).entries()) {
const end = COLOR_RAMP[index + RAMP_INDEX_STEP];
if (clamped >= start.stop && clamped <= end.stop) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

invert

yoavs8 added 2 commits February 4, 2026 20:03
Comment on lines 12 to 15
const COLOR_STOP_COOL = 0.2;
const COLOR_STOP_CYAN = 0.4;
const COLOR_STOP_GREEN = 0.6;
const COLOR_STOP_WARM = 0.8;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you are already putting the colors in the object just put the stops too

interface HeatMapProps {
positions: Point[];
path: string;
aspectRatio: number;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider adding comment of aspectRatio = width/height or vice versa, just actually write down which one you're using


interface HeatMapProps {
positions: Point[];
path: string;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure this belongs in the heatmap, if it does, name it appropriately (backgroundImagePath for example)

}

export const HeatMap: FC<HeatMapProps> = ({ positions, path, aspectRatio }) => {
const { heatmapLayerRef, imgRef, fallbackPoints, handleImageLoad, radius, overlaySize } = useHeatMap(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if these are all important props, just use heatmap as object, don't split them unnecessarily it's cluttered and it hurts to read

@@ -0,0 +1,129 @@
// בס"ד
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this entire file works, but it is not legible, it is not documented, and nobody in the team can concisely explain what it does. i'm passing it because it works, but you need to clean this up

});

const getRampColor = (value: number): ColorRGB => {
const clamped = Math.min(NORMALIZED_MAX, Math.max(NORMALIZED_MIN, value));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming value is not between 0 to 1 (why) - inverse lerp it so it sits between the two (and clamp)
example - normalized = clamp01((n - min) / (max - min))

Comment on lines +44 to +45
const ramp = COLOR_RAMP.slice(COLOR_RAMP_OFFSET, -RAMP_LAST_OFFSET);
const rampPairs = ramp.slice(COLOR_RAMP_OFFSET, -RAMP_INDEX_STEP);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

@YoniKiriaty YoniKiriaty added the feature A new Feature! label Feb 4, 2026
blue: Math.round(lerp(start.blue, end.blue, t)),
});

const getRampColor = (value: number): ColorRGB => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

homework: answer what the hell does value mean

@@ -0,0 +1,88 @@
// בס"ד
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

despite active protesting from the affected programmer - this file is also incomprehensible
fix it, but not now


export const useHeatMap = (
positions: Point[],
path: string,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is redundant


return {
heatmapLayerRef,
imgRef,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

);
}, [positions]);

useEffect(() => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correction - if not remove, justify why it exists alongside onImageLoad

@gerb82
Copy link

gerb82 commented Feb 4, 2026

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A new Feature!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants