Skip to content

Commit

Permalink
Shortcut calculation understands filters
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Dec 20, 2023
1 parent 1df777a commit 5bd083a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions backend/src/shortcuts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ impl Shortcuts {
let mut node_map = NodeMap::new();

for r in &neighbourhood.interior_roads {
if map.modal_filters.contains_key(r) {
continue;
}

let road = map.get_r(*r);
let i1 = node_map.get_or_insert(road.src_i);
let i2 = node_map.get_or_insert(road.dst_i);
Expand Down
17 changes: 14 additions & 3 deletions web/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,18 @@
mode: "network",
};
}
function onKeyDown(e: KeyboardEvent) {
if (e.key == "a") {
if (mode.mode == "neighbourhood" && !mode.addingFilter) {
mode.addingFilter = true;
}
}
}
</script>

<svelte:window on:keydown={onKeyDown} />

<Layout>
<div slot="left">
{#if map}
Expand All @@ -308,8 +318,9 @@
<div><button on:click={reset}>Reset</button></div>
<div><button on:click={setBoundaryMode}>Edit boundary</button></div>
<div>
<button on:click={() => (mode.addingFilter = true)}
>Add a modal filter</button
<button
on:click={() => (mode.addingFilter = true)}
disabled={mode.addingFilter}>Add a modal filter</button
>
</div>
<p>Analyze and edit now</p>
Expand All @@ -332,7 +343,7 @@
{map}
{app}
boundary={mode.boundary}
addingFilter={mode.addingFilter}
bind:addingFilter={mode.addingFilter}
/>
{/if}
{/if}
Expand Down

0 comments on commit 5bd083a

Please sign in to comment.