Skip to content

Commit 11377ef

Browse files
committed
Stop showing debug stuff in neighbourhood mode, and bring in modal improvements from Snape
1 parent 57341ad commit 11377ef

File tree

3 files changed

+37
-11
lines changed

3 files changed

+37
-11
lines changed

web/src/DebugMode.svelte

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { Popup } from "svelte-maplibre";
2+
import { CircleLayer, Popup } from "svelte-maplibre";
33
import { notNull, PropertiesTable } from "./common";
44
import RenderNeighbourhood from "./RenderNeighbourhood.svelte";
55
import SplitComponent from "./SplitComponent.svelte";
@@ -33,6 +33,19 @@
3333
<PropertiesTable properties={notNull(data).properties} />
3434
</Popup>
3535
</div>
36+
<svelte:fragment slot="more-layers">
37+
<CircleLayer
38+
filter={["==", ["get", "kind"], "border_intersection"]}
39+
paint={{
40+
"circle-radius": 15,
41+
"circle-color": "green",
42+
}}
43+
>
44+
<Popup openOn="hover" let:data>
45+
<PropertiesTable properties={notNull(data).properties} />
46+
</Popup>
47+
</CircleLayer>
48+
</svelte:fragment>
3649
</RenderNeighbourhood>
3750
</div>
3851
</SplitComponent>

web/src/RenderNeighbourhood.svelte

+3-9
Original file line numberDiff line numberDiff line change
@@ -105,22 +105,16 @@
105105
</LineLayer>
106106

107107
<CircleLayer
108-
filter={isPoint}
108+
filter={["==", ["get", "kind"], "modal_filter"]}
109109
paint={{
110110
"circle-radius": 15,
111-
"circle-color": constructMatchExpression(
112-
["get", "kind"],
113-
{
114-
border_intersection: "green",
115-
modal_filter: "black",
116-
},
117-
"red"
118-
),
111+
"circle-color": "black",
119112
}}
120113
on:click={(e) => interactive && onClickCircle(e.detail.features[0])}
121114
>
122115
{#if interactive}
123116
<slot name="circle-popup" />
124117
{/if}
125118
</CircleLayer>
119+
<slot name="more-layers" />
126120
</GeoJSON>

web/src/common/Modal.svelte

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
<script lang="ts">
22
// It starts open
33
// on:close is forwarded
4-
let dialog;
4+
let dialog: HTMLDialogElement;
5+
6+
function onClick(e: MouseEvent) {
7+
if (dialog.open) {
8+
// Anything inside the modal counts as the <div> or something inside that
9+
if (e.target == dialog) {
10+
dialog.close();
11+
}
12+
}
13+
}
14+
15+
function onKeyDown(e: KeyboardEvent) {
16+
if (e.key == "Escape" || e.key == "Enter") {
17+
e.stopPropagation();
18+
dialog.close();
19+
}
20+
}
521
</script>
622

23+
<svelte:window on:click={onClick} on:keydown={onKeyDown} />
24+
725
<dialog open on:close bind:this={dialog}>
826
<div>
927
<slot {dialog} />
@@ -28,5 +46,6 @@
2846
width: 80%;
2947
height: 80%;
3048
background: white;
49+
overflow: scroll;
3150
}
3251
</style>

0 commit comments

Comments
 (0)