-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(map): add optional occupation stripes to map and legend
- Loading branch information
1 parent
19af168
commit 24cd624
Showing
14 changed files
with
388 additions
and
46 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
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
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,83 @@ | ||
<script lang="ts"> | ||
import { mapSettings } from '../settings'; | ||
import type { MapData } from './data/processMapData'; | ||
import { getFillColorAttributes } from './mapUtils'; | ||
export let data: MapData; | ||
export let colors: Record<string, string>; | ||
$: fullOccupiers = data.occupationBorders.filter((b) => !b.partial).map((b) => b.occupier); | ||
$: partialOccupiers = new Set( | ||
data.occupationBorders.filter((b) => b.partial).map((b) => b.occupier), | ||
); | ||
</script> | ||
|
||
<pattern | ||
id="pattern-full-occupier" | ||
viewBox="0,0,10,20" | ||
preserveAspectRatio="none" | ||
width="10" | ||
height="5" | ||
patternUnits="userSpaceOnUse" | ||
patternTransform="rotate(-45)" | ||
> | ||
<rect fill="white" width="10" height="6" /> | ||
</pattern> | ||
<pattern | ||
id="pattern-partial-occupier" | ||
viewBox="0,0,10,20" | ||
preserveAspectRatio="none" | ||
width="10" | ||
height="5" | ||
patternUnits="userSpaceOnUse" | ||
patternTransform="rotate(-45)" | ||
> | ||
<rect fill="white" width="10" height="3" /> | ||
</pattern> | ||
|
||
{#each data.occupationBorders as occupation} | ||
<pattern | ||
id="pattern-${occupation.partial | ||
? 'partial' | ||
: 'full'}-occupation-{occupation.occupier}-on-{occupation.occupied}" | ||
viewBox="0,0,10,20" | ||
preserveAspectRatio="none" | ||
width="10" | ||
height="5" | ||
patternUnits="userSpaceOnUse" | ||
patternTransform="rotate(-45)" | ||
> | ||
<rect | ||
{...getFillColorAttributes({ | ||
mapSettings: $mapSettings, | ||
colors, | ||
countryColors: [occupation, data.borders.find((b) => b.countryId === occupation.occupied)], | ||
colorStack: [$mapSettings.occupationColor, $mapSettings.borderFillColor], | ||
})} | ||
width="10" | ||
height={occupation.partial ? 3 : 6} | ||
/> | ||
</pattern> | ||
{/each} | ||
<!-- {#each partialOccupiers as occupier} | ||
<pattern | ||
id="pattern-partial-occupier-{occupier}-on-{occupied}" | ||
viewBox="0,0,10,20" | ||
preserveAspectRatio="none" | ||
width="5" | ||
height="5" | ||
patternUnits="userSpaceOnUse" | ||
patternTransform="rotate(-45)" | ||
> | ||
<rect | ||
{...getFillColorAttributes({ | ||
mapSettings: $mapSettings, | ||
colors, | ||
countryColors: data.occupationBorders.find((b) => b.occupier === occupier), | ||
colorStack: [$mapSettings.borderColor, $mapSettings.borderFillColor], | ||
})} | ||
width="10" | ||
height="3" | ||
/> | ||
</pattern> | ||
{/each} --> |
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
Oops, something went wrong.