aotds-docks/src/lib/components/Weapon/Submunition/index.svelte

36 lines
778 B
Svelte
Raw Normal View History

2020-07-27 22:17:55 +00:00
<label> submunition pack</label>
2022-03-01 17:42:33 +00:00
<Arcs selected={arcs} on:click_arc={({ detail }) => click_arc(detail)} />
2020-07-27 22:17:55 +00:00
<script>
2022-03-01 17:42:33 +00:00
import { getContext } from "svelte";
import Arcs from "../Arcs/index.svelte";
import dux from "$lib/dux";
import { createEventDispatcher } from "svelte";
2021-05-17 13:48:31 +00:00
2022-03-01 17:42:33 +00:00
const all_arcs = ["FS", "F", "FP", "AP", "A", "AS"];
2020-07-27 22:17:55 +00:00
2022-03-01 17:42:33 +00:00
export let arcs = ["F"];
export let ship_change = getContext("ship_change") || (() => {});
2020-07-27 22:17:55 +00:00
2022-03-01 17:42:33 +00:00
const click_arc = (arc) => {
if (arcs[0] === arc) return;
arcs = [arc];
};
2020-07-27 22:17:55 +00:00
2022-03-01 17:42:33 +00:00
const dispatch = createEventDispatcher();
let cache;
$: cache = arcs.join(":");
2020-07-27 22:17:55 +00:00
2022-03-01 17:42:33 +00:00
$: dispatch("change", {
arcs: cache.split(":"),
});
2020-07-27 22:17:55 +00:00
</script>
<style>
2022-03-01 17:42:33 +00:00
.arc {
2020-07-27 22:17:55 +00:00
display: flex;
flex-direction: column;
margin-right: 1em;
2022-03-01 17:42:33 +00:00
}
</style>