From 8fe1ed0c0c84cbe76c0d437dcdaaf02018987686 Mon Sep 17 00:00:00 2001 From: Andrew Michael McNutt Date: Mon, 12 Feb 2024 17:08:33 -0800 Subject: [PATCH] make creating pals by type really easy, remove r2 example --- public/examples/r2.svg | 78 ------------------------- src/controls/NewPal.svelte | 76 ++++++++++++++++++------ src/scatterplot/ColorScatterPlot.svelte | 5 +- src/stores/color-store.ts | 1 + src/stores/example-store.ts | 1 - 5 files changed, 63 insertions(+), 98 deletions(-) delete mode 100644 public/examples/r2.svg diff --git a/public/examples/r2.svg b/public/examples/r2.svg deleted file mode 100644 index 6603ca0d..00000000 --- a/public/examples/r2.svg +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/controls/NewPal.svelte b/src/controls/NewPal.svelte index 0930633f..e09b92d5 100644 --- a/src/controls/NewPal.svelte +++ b/src/controls/NewPal.svelte @@ -1,9 +1,9 @@ @@ -70,7 +76,7 @@ + +
diff --git a/src/scatterplot/ColorScatterPlot.svelte b/src/scatterplot/ColorScatterPlot.svelte index 9cfbc6bf..9a71de5a 100644 --- a/src/scatterplot/ColorScatterPlot.svelte +++ b/src/scatterplot/ColorScatterPlot.svelte @@ -83,7 +83,10 @@ $: selectionColor = bgLum > 0.35 ? "#55330066" : "#ffeeccaa"; let hoveredIndex: number | false = false; - $: hoveredPoint = hoveredIndex === false ? false : colors[hoveredIndex]; + $: hoveredPoint = + hoveredIndex === false || !colors[hoveredIndex] + ? false + : colors[hoveredIndex]; // coordinate transforms $: scales = makeScales( diff --git a/src/stores/color-store.ts b/src/stores/color-store.ts index 8e8f92e9..775436f2 100644 --- a/src/stores/color-store.ts +++ b/src/stores/color-store.ts @@ -24,6 +24,7 @@ type Pal = { type: PalType; }; export type Palette = Pal; +export type StringPalette = Pal; interface StoreData { palettes: Pal[]; diff --git a/src/stores/example-store.ts b/src/stores/example-store.ts index 0ec19476..79a91262 100644 --- a/src/stores/example-store.ts +++ b/src/stores/example-store.ts @@ -24,7 +24,6 @@ export const DEMOS = [ { type: "svg", title: "Holy Grail", filename: "./examples/HolyGrail.svg" }, { type: "svg", title: "Fourier", filename: "./examples/fourier.svg" }, { type: "svg", title: "Mondrian", filename: "./examples/mondrian.svg" }, - { type: "svg", title: "R Squared", filename: "./examples/r2.svg" }, { type: "svg", title: "Vis Logo", filename: "./examples/vis-logo.svg" }, { type: "vega",