-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Let the user add a fixed image to the map and move/scale/rotate it. No
saving or nice controls yet.
- Loading branch information
1 parent
25f8dfb
commit 8cedfef
Showing
7 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script lang="ts"> | ||
// TODO This should just be part of InterventionLayer? treat it like a | ||
// feature? could even base64 encode the bytes to embed it, at risk of | ||
// blowing up local storage? | ||
import { map } from "stores"; | ||
import { Marker } from "svelte-maplibre"; | ||
import imgUrl from "../../../../assets/warning.svg?url"; | ||
import { opacity, rotate, scale } from "./stores"; | ||
let lngLat = $map.getCenter().toArray(); | ||
$: style = `transform: rotate(${$rotate}deg); opacity: ${$opacity / 100.0}`; | ||
</script> | ||
|
||
<Marker bind:lngLat draggable> | ||
<img src={imgUrl} alt="Georeferenced image" width={$scale * 50} {style} /> | ||
</Marker> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<script lang="ts"> | ||
import { SecondaryButton } from "lib/govuk"; | ||
import { mode } from "stores"; | ||
import { opacity, rotate, scale } from "./stores"; | ||
</script> | ||
|
||
<SecondaryButton on:click={() => mode.set({ mode: "list" })}> | ||
Cancel | ||
</SecondaryButton> | ||
|
||
<div> | ||
<label> | ||
Scale | ||
<input type="number" min="0.1" step="0.1" bind:value={$scale} /> | ||
</label> | ||
</div> | ||
<div> | ||
<label> | ||
Rotation (degrees) | ||
<input type="number" bind:value={$rotate} /> | ||
</label> | ||
</div> | ||
|
||
<div> | ||
<label> | ||
<input type="range" min="0" max="100" bind:value={$opacity} /> | ||
Opacity | ||
</label> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { writable, type Writable } from "svelte/store"; | ||
|
||
// Use this to share between two components, nested under the sidebar and map | ||
|
||
export const scale: Writable<number> = writable(1.0); | ||
export const rotate: Writable<number> = writable(0.0); | ||
export const opacity: Writable<number> = writable(100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters