Skip to content

Commit 882f302

Browse files
authored
render hover halo over not under squares (#2236)
## Description I previously used `discard` to draw edges on the map instead of using sea color and I rendered the hover halo _below_ the squares. I woke up feeling bad about it so now the code is simpler and the hover effect is positioned how we'd expect it. <img width="309" height="133" alt="image" src="https://github.com/user-attachments/assets/d2b521f9-6085-4666-a339-4e0c3493b97b" />
1 parent 397b411 commit 882f302

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/app/(main)/community/events/map/shaders.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,9 @@ void main() {
158158
vec2 delta = abs(fragPx - center);
159159
bool insideSquare = delta.x <= squareHalf && delta.y <= squareHalf;
160160
bool isSeaCell = markerType <= 0.5 && landCoverage < 0.5;
161-
bool shouldRenderHalo = !insideSquare || isSeaCell;
162-
if (shouldRenderHalo) {
163-
if (haloIntensity <= 0.0) {
164-
discard;
165-
}
166-
float haloAlpha = clamp(haloIntensity, 0.0, 1.0);
167-
color = mix(uSeaColor, uHaloColor, haloAlpha);
168-
outColor = vec4(color, 1.0);
169-
return;
170-
}
161+
float haloAlpha = clamp(haloIntensity, 0.0, 1.0);
162+
color = (isSeaCell || !insideSquare) ? uSeaColor : color;
163+
color = mix(color, uHaloColor, haloAlpha);
171164
outColor = vec4(color, 1.0);
172165
}
173166
`

0 commit comments

Comments
 (0)