From 10290cce8c77dcc517d9cc99563086057f988310 Mon Sep 17 00:00:00 2001 From: Andrew Michael McNutt Date: Wed, 21 Feb 2024 09:29:46 -0800 Subject: [PATCH 1/3] small bugs (examples duplicated) and some ui tweaks --- src/App.svelte | 2 +- src/content-modules/ComparePal.svelte | 24 +++++++++++++------ src/content-modules/MainColumn.svelte | 1 + src/example/ExampleAlaCarte.svelte | 6 ++++- src/example/Swatches.svelte | 26 +++++++++++--------- src/lib/lints/max-colors.ts | 2 +- src/scatterplot/ColorScatterPlot.svelte | 32 +++++++++++-------------- src/stores/example-store.ts | 14 +++-------- 8 files changed, 57 insertions(+), 50 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index 270cea4f..29b17825 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -39,7 +39,7 @@ $: updateSearchDebounced = debounce(10, (pal: any) => { // keep the noise down on the console if (!selectedLint && pal) { - lint(pal).then((res) => { + lint(pal, true).then((res) => { lintStore.postCurrentChecks(res); }); } diff --git a/src/content-modules/ComparePal.svelte b/src/content-modules/ComparePal.svelte index a035feab..c9cf7303 100644 --- a/src/content-modules/ComparePal.svelte +++ b/src/content-modules/ComparePal.svelte @@ -33,7 +33,7 @@ let colorSpace = ComparisonPal?.colorSpace || "lab"; -
+
{#if ComparisonPal !== undefined}
@@ -112,7 +112,10 @@
@@ -124,13 +127,20 @@ /> -->
{/if} -
-
+
{#if exampleIdx === -1} + allowInteraction && focusStore.setColors( dealWithFocusEvent(e, i, $focusStore.focusedColors) )} @@ -102,13 +104,14 @@ }`} style={`${styleMap(colors[colorIdx])}`} on:click|preventDefault|stopPropagation={(e) => { - focusStore.setColors( - dealWithFocusEvent( - e, - colorIdx, - $focusStore.focusedColors - ) - ); + allowInteraction && + focusStore.setColors( + dealWithFocusEvent( + e, + colorIdx, + $focusStore.focusedColors + ) + ); }} > {/each} @@ -125,9 +128,10 @@ }deg)`} class="mr-2 w-16" on:click|preventDefault|stopPropagation={(e) => { - focusStore.setColors( - dealWithFocusEvent(e, i, $focusStore.focusedColors) - ); + allowInteraction && + focusStore.setColors( + dealWithFocusEvent(e, i, $focusStore.focusedColors) + ); }} > {color.toHex()} diff --git a/src/lib/lints/max-colors.ts b/src/lib/lints/max-colors.ts index efc7a664..1fec7e17 100644 --- a/src/lib/lints/max-colors.ts +++ b/src/lib/lints/max-colors.ts @@ -7,7 +7,7 @@ const lint: CustomLint = { program: JSONToPrettyString({ // @ts-ignore $schema: `${location.href}lint-schema.json`, - "<": { left: { count: "colors" }, right: 10 }, + "<": { left: { count: "colors" }, right: 11 }, }), taskTypes: ["sequential", "diverging", "categorical"] as const, level: "warning", diff --git a/src/scatterplot/ColorScatterPlot.svelte b/src/scatterplot/ColorScatterPlot.svelte index f2a9bee7..78ff7456 100644 --- a/src/scatterplot/ColorScatterPlot.svelte +++ b/src/scatterplot/ColorScatterPlot.svelte @@ -34,7 +34,7 @@ $: focusSet = new Set(focusedColors); - let margin = { top: 15, right: 15, bottom: 15, left: 15 }; + let margin = { top: 20, right: 15, bottom: 15, left: 15 }; $: plotWidth = width - margin.left - margin.right; $: plotHeight = height - margin.top - margin.bottom; $: extents = { @@ -468,6 +468,17 @@ on:touchend|preventDefault={puttingEnd} /> {/if} + + + {#if typeof hoveredPoint !== "boolean"} + + + {hoveredPoint.toHex()} + + {hoveredPoint.toPrettyString()} + + + {/if}
@@ -577,24 +588,9 @@
-
- {#if typeof hoveredPoint !== "boolean"} - Hovered point: - {hoveredPoint.toPrettyString()} - - {hoveredPoint.toHex()} -
- {:else} -   - {/if} +
+ {#if $configStore.showGamutMarkers}✖ indicates value that is out of gamut{:else} {/if}
-{#if $configStore.showGamutMarkers} -
- X indicates value that is out of gamut -
-{/if}