Skip to content

Commit 00ca416

Browse files
committed
Add haloMinOpacity
1 parent 752bc2f commit 00ca416

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ class MapEngine implements MapHandle {
111111
private markerCapacityWarned = false
112112
private readonly markerColor: Float32Array
113113
private haloColor: Float32Array
114+
private haloMinOpacity: number
114115
private readonly markerIntensity: Float32Array
115116
private readonly markerIntensityTarget: Float32Array
116117
private readonly markerIndexById: Map<string, number>
@@ -160,6 +161,7 @@ class MapEngine implements MapHandle {
160161
this.markerCount = this.packMarkers(this.markerPoints, this.markerData)
161162
this.markerColor = new Float32Array(options.theme.marker)
162163
this.haloColor = new Float32Array(options.theme.halo)
164+
this.haloMinOpacity = options.theme.haloMinOpacity
163165
this.markerIntensity = new Float32Array(MARKER_CAPACITY)
164166
this.markerIntensityTarget = new Float32Array(MARKER_CAPACITY)
165167
this.markerIndexById = new Map()
@@ -200,6 +202,7 @@ class MapEngine implements MapHandle {
200202
this.landColor.set(colors.land)
201203
this.markerColor.set(colors.marker)
202204
this.haloColor.set(colors.halo)
205+
this.haloMinOpacity = colors.haloMinOpacity
203206
}
204207

205208
setActiveMarker(id: string | null) {
@@ -658,6 +661,7 @@ class MapEngine implements MapHandle {
658661
this.haloColor[1],
659662
this.haloColor[2],
660663
)
664+
setUniform1f(gl, this.dotsProgram, "uHaloMinOpacity", this.haloMinOpacity)
661665
setUniform1i(gl, this.dotsProgram, "uMarkerCount", this.markerCount)
662666
gl.activeTexture(gl.TEXTURE0)
663667
gl.bindTexture(gl.TEXTURE_2D, this.landTexture)

src/app/(main)/community/events/map/map-colors.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export type MapColors = {
55
land: ColorVec3
66
marker: ColorVec3
77
halo: ColorVec3
8+
haloMinOpacity: number
89
}
910

1011
export const MAP_COLORS = {
@@ -13,12 +14,14 @@ export const MAP_COLORS = {
1314
land: [0.8627, 0.8706, 0.8275], // neu-300
1415
marker: [0.8824, 0.0039, 0.5961], // #E10198 = pri-base
1516
halo: [1.0, 0.6, 0.8784], // hsl(318, 100%, 80%) = pri-light
17+
haloMinOpacity: 0.75,
1618
},
1719
dark: {
1820
sea: [0.0549, 0.0588, 0.0431], // neu-50
1921
land: [0.1647, 0.1804, 0.1373], // a shade darker than neu-800
2022
marker: [1, 0.6, 0.8745], // #FF99DF = pri-light
2123
halo: [1.0, 0.8, 0.9373], // hsl(319, 100%, 90%) = pri-lighter
24+
haloMinOpacity: 0.5,
2225
},
2326
} satisfies Record<string, MapColors>
2427

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ uniform vec4 uMarkers[${MARKER_CAPACITY}];
3232
uniform int uMarkerCount;
3333
uniform vec3 uMarkerColor;
3434
uniform vec3 uHaloColor;
35+
uniform float uHaloMinOpacity;
3536
3637
vec2 markerCellCenter(vec4 marker, vec2 referencePx) {
3738
float periodX = uWorldSize.x * uZoom;
@@ -106,8 +107,7 @@ void main() {
106107
float radiusDiff = max(outerRadius - innerRadius, 0.0001);
107108
float t = clamp((dist - innerRadius) / radiusDiff, 0.0, 1.0);
108109
float logFalloff = 1.0 - log(1.0 + t * 9.0) / log(10.0);
109-
float minOpacity = 0.5;
110-
float halo = minOpacity * logFalloff * strength;
110+
float halo = uHaloMinOpacity * logFalloff * strength;
111111
haloIntensity = max(haloIntensity, halo);
112112
}
113113
}

src/app/(main)/community/events/meetups-list.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { clsx } from "clsx"
44
import ExternalLinkIcon from "@/app/conf/_design-system/pixelarticons/external-link.svg?svgr"
55

66
import { meetups as meetupNodes } from "@/components/meetups"
7+
import { useEffect } from "react"
78

89
type MeetupListItem = {
910
id: string
@@ -45,10 +46,27 @@ export function MeetupsList({
4546
onActiveMeetupChange,
4647
meetups = DEFAULT_MEETUPS,
4748
}: MeetupsListProps) {
49+
useEffect(() => {
50+
if (activeMeetupId) {
51+
const list = document.querySelector("#meetups-list")
52+
if (!list) return
53+
54+
const activeAnchor = list.querySelector<HTMLAnchorElement>(
55+
`a[aria-current="true"]`,
56+
)
57+
if (!activeAnchor) return
58+
59+
if (list.scrollTop + list.clientHeight < activeAnchor.offsetTop) {
60+
list.scrollTo({ top: activeAnchor.offsetTop, behavior: "smooth" })
61+
}
62+
}
63+
}, [activeMeetupId])
64+
4865
if (meetups.length === 0) return null
4966

5067
return (
5168
<ul
69+
id="meetups-list"
5270
className={clsx(
5371
"nextra-scrollbar overflow-y-auto scrollview-fade-y-16 scrollview-fade md:h-full",
5472
className,

0 commit comments

Comments
 (0)