Skip to content

Commit

Permalink
Slightly improve weird color bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Jan 5, 2024
1 parent 3b9ac69 commit a8bae0a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions web/src/RenderNeighbourhood.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
let gj: FeatureCollection;
let maxShortcuts: number;
$: render(gjInput, $showBasemap);
// TODO if we could set both reactively, thatd be ideal
$: render(gjInput);
function render(x: FeatureCollection, y: boolean) {
function render(x: FeatureCollection) {
// A qualitative palette from colorbrewer2.org, skipping the red hue (used
// for levels of shortcutting) and grey (too close to the basemap)
let cell_colors = [
Expand All @@ -50,6 +51,7 @@
if (f.properties.color == "disconnected") {
f.properties.color = "red";
} else if (Object.hasOwn(f.properties, "color")) {
// TODO Uhh weird when this runs twice
f.properties.color =
cell_colors[f.properties.color % cell_colors.length];
}
Expand Down

0 comments on commit a8bae0a

Please sign in to comment.