Skip to content

Commit 42a0a20

Browse files
committed
Fix bug with cell colors and HMR
1 parent 11377ef commit 42a0a20

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

backend/src/neighbourhood.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ impl Neighbourhood {
109109
{
110110
let mut f = Feature::from(Geometry::from(&map.mercator.to_wgs84(&polygons)));
111111
match color {
112-
Color::Disconnected => f.set_property("color", "disconnected"),
113-
Color::Cell(idx) => f.set_property("color", idx),
112+
Color::Disconnected => f.set_property("cell_color", "disconnected"),
113+
Color::Cell(idx) => f.set_property("cell_color", idx),
114114
}
115115
features.push(f);
116116
}

web/src/RenderNeighbourhood.svelte

+4-10
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@
77
hoverStateFilter,
88
LineLayer,
99
} from "svelte-maplibre";
10-
import {
11-
constructMatchExpression,
12-
isLine,
13-
isPoint,
14-
isPolygon,
15-
} from "./common";
10+
import { constructMatchExpression, isLine, isPolygon } from "./common";
1611
import { showBasemap } from "./stores";
1712
1813
export let gjInput: FeatureCollection;
@@ -48,12 +43,11 @@
4843
4944
for (let f of gjInput.features) {
5045
f.properties ??= {};
51-
if (f.properties.color == "disconnected") {
46+
if (f.properties.cell_color == "disconnected") {
5247
f.properties.color = "red";
53-
} else if (Object.hasOwn(f.properties, "color")) {
54-
// TODO Uhh weird when this runs twice
48+
} else if (Object.hasOwn(f.properties, "cell_color")) {
5549
f.properties.color =
56-
cell_colors[f.properties.color % cell_colors.length];
50+
cell_colors[f.properties.cell_color % cell_colors.length];
5751
}
5852
}
5953

0 commit comments

Comments
 (0)