fix: modal click handler + colormap gradient color format

This commit is contained in:
Antoine Jacquin
2026-07-29 00:11:50 +02:00
parent 3d79a5ee72
commit 35bd827790

View File

@ -588,7 +588,7 @@ for (let r = bbox.max_row; r >= bbox.min_row; r--) {{
if (tile) {{
div.title = tile.name;
const img = document.createElement('img';
const img = document.createElement('img');
img.loading = 'lazy';
div.appendChild(img);
@ -597,9 +597,9 @@ for (let r = bbox.max_row; r >= bbox.min_row; r--) {{
label.textContent = `${{c}},${{r}}`;
div.appendChild(label);
// Click handler for modal
// Click handler for modal (ignore if we dragged)
div.addEventListener('click', (e) => {{
if (isDragging) return;
if (dragDistance > dragThreshold) return;
openModal(c, r);
}});
}}
@ -783,7 +783,8 @@ function drawWithLegend(img, vizKey, tile, meta) {{
const colors = getColormapColors(meta.cmap, meta.diverging);
for (let i = 0; i < colors.length; i++) {{
const t = i / (colors.length - 1);
grad.addColorStop(t, colors[i]);
const c = colors[i];
grad.addColorStop(t, `rgb(${{c[0]}},${{c[1]}},${{c[2]}})`);
}}
ctx.fillStyle = grad;