-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathConstructionMenu.svelte
More file actions
35 lines (29 loc) · 1003 Bytes
/
ConstructionMenu.svelte
File metadata and controls
35 lines (29 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<script lang="ts">
import Menu from '@smui/menu';
import List, {Item, Text, Graphic} from '@smui/list';
import { createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
export let languages
export let languageIcons
let menu
let anchor
let anchorX
let anchorY
export function open(x, y) {
anchorX = x
anchorY = y
menu.setOpen(true)
}
</script>
<div class="anchor" bind:this={anchor} style={`position: absolute; left: ${anchorX}px; top: ${anchorY}px;`}>
<Menu bind:this={menu} bind:anchorElement={anchor}>
<List>
{#each languages as lang}
<Item on:SMUI:action={() => dispatch('language-clicked', lang)}>
<Graphic class="material-icons">{languageIcons[lang.name]}</Graphic>
<Text>Create <b>{lang.name}</b> expression</Text>
</Item>
{/each}
</List>
</Menu>
</div>