Skip to content

Commit

Permalink
Move draw controls into the map toolbox, out of the sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Oct 22, 2024
1 parent b575126 commit 8b8f994
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 51 deletions.
1 change: 0 additions & 1 deletion assets/help.svg

This file was deleted.

6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"humanize-string": "^3.0.0",
"js-cookie": "^3.0.5",
"maplibre-gl": "^4.0.2",
"scheme-sketcher-lib": "github:acteng/scheme-sketcher-lib",
"scheme-sketcher-lib": "github:acteng/scheme-sketcher-lib#move_draw_controls",
"svelte": "^4.2.10",
"svelte-maplibre": "^0.9.7",
"uuid": "^9.0.1"
Expand Down
31 changes: 0 additions & 31 deletions src/lib/common/HelpButton.svelte

This file was deleted.

3 changes: 1 addition & 2 deletions src/lib/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export { default as ColorLegend } from "./ColorLegend.svelte";
export { default as ExternalLink } from "./ExternalLink.svelte";
export { default as Geocoder } from "./Geocoder.svelte";
export { default as Header } from "./Header.svelte";
export { default as HelpButton } from "./HelpButton.svelte";
export { default as Layout } from "./Layout.svelte";
export { default as Legend } from "./Legend.svelte";
export { default as LineMeasureTool } from "./LineMeasureTool.svelte";
Expand All @@ -16,7 +15,7 @@ export { default as Popup } from "./Popup.svelte";
export { default as MapLibreMap } from "./MapLibreMap.svelte";
export { default as ZoomOutMap } from "./ZoomOutMap.svelte";
export * from "./storage";
export { Modal, WarningIcon } from "scheme-sketcher-lib/common";
export { HelpButton, Modal, WarningIcon } from "scheme-sketcher-lib/common";

export async function getAuthoritiesGeoJson(): Promise<AuthorityBoundaries> {
let resp = await fetch(authoritiesUrl);
Expand Down
6 changes: 4 additions & 2 deletions src/lib/sketch/EditFeatureForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
export let cfg: Config<InterventionProps, OurSchemeData>;
export let gjSchemes: Writable<Schemes>;
export let id: number;
export let id: number | null;
export let props: FeatureProps<InterventionProps>;
// Workaround unused var warning
cfg;
</script>

<UnexpectedProperties {gjSchemes} {id} {props} />
{#if id != null}
<UnexpectedProperties {gjSchemes} {id} {props} />
{/if}
{#if $schema == "v1"}
<FormV1 {gjSchemes} bind:props />
{:else if $schema == "pipeline"}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/sketch/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ export let cfg: Config<InterventionProps, OurSchemeData> = {
},
newLineStringFeature: (f) => {
f.properties.intervention_type = "route";
if (f.properties.route_name) {
if (f.properties.route_name && !f.properties.name) {
if (get(schemaStore) != "pipeline") {
f.properties.name = f.properties.route_name;
}
delete f.properties.route_name;
}
delete f.properties.route_name;
},

updateFeature: (destination, source) => {
Expand Down
19 changes: 10 additions & 9 deletions src/pages/SketchSchemes.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
InterventionLayer,
PolygonToolLayer,
RouteSnapperLayer,
SplitRouteMode,
Toolbox,
NewFeatureForm,
} from "scheme-sketcher-lib/draw";
import {
appVersion,
Expand All @@ -28,7 +28,7 @@
import About from "lib/sketch/About.svelte";
import FileManagement from "lib/sketch/FileManagement.svelte";
import Instructions from "lib/sketch/Instructions.svelte";
import { PerModeControls } from "scheme-sketcher-lib/sidebar";
import { ListMode, EditForm } from "scheme-sketcher-lib/sidebar";
import { map, mapStyle, schema } from "stores";
import { onMount } from "svelte";
import { cfg } from "lib/sketch/config";
Expand Down Expand Up @@ -97,7 +97,6 @@
return authorityName;
}
// Need this to set up PerModeControls
$: if ($map) {
sketchMapStore.set($map);
}
Expand Down Expand Up @@ -128,7 +127,13 @@
</ButtonGroup>
{/if}
<FileManagement {cfg} {gjSchemes} {authorityName} />
<PerModeControls {cfg} {gjSchemes} {routeSnapperUrl} />
{#if $mode.mode == "list"}
<ListMode {cfg} {gjSchemes} />
{:else if $mode.mode == "edit-form"}
<EditForm {cfg} {gjSchemes} id={$mode.id} />
{:else if $mode.mode == "new-point" || $mode.mode == "new-freehand-polygon" || $mode.mode == "new-snapped-polygon" || $mode.mode == "new-route"}
<NewFeatureForm {cfg} {gjSchemes} />
{/if}
{#if $mode.mode != "list"}
<hr />
{/if}
Expand All @@ -141,11 +146,7 @@
<BoundaryLayer {cfg} {boundaryGeojson} />
<InterventionLayer {cfg} {gjSchemes} />
<ImageLayer {cfg} />
{#if $mode.mode == "list"}
<Toolbox {cfg} {gjSchemes} />
{:else if $mode.mode == "split-route"}
<SplitRouteMode {cfg} {gjSchemes} />
{/if}
<Toolbox {cfg} {gjSchemes} {routeSnapperUrl} />
<RouteSnapperLayer {cfg} />
<PolygonToolLayer {cfg} />
{/if}
Expand Down

0 comments on commit 8b8f994

Please sign in to comment.