Skip to content

Commit

Permalink
Manage teardown of route tool in Toolbox too, for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Apr 27, 2023
1 parent 96e55ba commit 5d0e927
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/lib/draw/Toolbox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
export let routeUrl: string;
export let planningMode: boolean;
// Plumbed up from RouteMode, so we can pass it down to GeometryMode
// TODO Reconsider
// TODO Create this here too?
let routeTool: RouteTool;
// Create and manage these here, then pass down to modes as needed.
// TODO Teardown too
let pointTool = new PointTool($map);
let polygonTool = new PolygonTool($map);
Expand Down Expand Up @@ -60,6 +59,7 @@
onDestroy(() => {
pointTool?.tearDown();
polygonTool?.tearDown();
routeTool?.tearDown();
});
</script>

Expand Down
6 changes: 1 addition & 5 deletions src/lib/draw/route/RouteMode.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import type { Mode } from "../types";
import { onMount, onDestroy } from "svelte";
import { onMount } from "svelte";
import init from "route-snapper";
import { fetchWithProgress } from "route-snapper/lib.js";
import { RouteTool } from "./route_tool";
Expand Down Expand Up @@ -63,10 +63,6 @@
}
});
});
onDestroy(() => {
routeTool?.tearDown();
});
</script>

{#if !routeTool}
Expand Down

0 comments on commit 5d0e927

Please sign in to comment.