fix: modal click handler + colormap gradient color format
This commit is contained in:
@ -588,7 +588,7 @@ for (let r = bbox.max_row; r >= bbox.min_row; r--) {{
|
|||||||
|
|
||||||
if (tile) {{
|
if (tile) {{
|
||||||
div.title = tile.name;
|
div.title = tile.name;
|
||||||
const img = document.createElement('img';
|
const img = document.createElement('img');
|
||||||
img.loading = 'lazy';
|
img.loading = 'lazy';
|
||||||
div.appendChild(img);
|
div.appendChild(img);
|
||||||
|
|
||||||
@ -597,9 +597,9 @@ for (let r = bbox.max_row; r >= bbox.min_row; r--) {{
|
|||||||
label.textContent = `${{c}},${{r}}`;
|
label.textContent = `${{c}},${{r}}`;
|
||||||
div.appendChild(label);
|
div.appendChild(label);
|
||||||
|
|
||||||
// Click handler for modal
|
// Click handler for modal (ignore if we dragged)
|
||||||
div.addEventListener('click', (e) => {{
|
div.addEventListener('click', (e) => {{
|
||||||
if (isDragging) return;
|
if (dragDistance > dragThreshold) return;
|
||||||
openModal(c, r);
|
openModal(c, r);
|
||||||
}});
|
}});
|
||||||
}}
|
}}
|
||||||
@ -783,7 +783,8 @@ function drawWithLegend(img, vizKey, tile, meta) {{
|
|||||||
const colors = getColormapColors(meta.cmap, meta.diverging);
|
const colors = getColormapColors(meta.cmap, meta.diverging);
|
||||||
for (let i = 0; i < colors.length; i++) {{
|
for (let i = 0; i < colors.length; i++) {{
|
||||||
const t = i / (colors.length - 1);
|
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;
|
ctx.fillStyle = grad;
|
||||||
|
|||||||
Reference in New Issue
Block a user