ToolBar.vue 1.03 KB
Newer Older
1
2
3
4
5
6
<template>
  <div>
    <button @click="addNode()">Add Node</button>
    <button>Select Node</button>
    <button>Make Connections</button>
    <UploadMedia />
Adam Procter's avatar
Adam Procter committed
7
    <button @click="exitMicrocosm()">Exit</button>
8
9
10
11
12
13
  </div>
</template>

<script>
// @ is an alias to /src
import UploadMedia from '@/components/UploadMedia.vue'
Adam Procter's avatar
Adam Procter committed
14
import shortcuts from '@/mixins/shortcuts'
15
16
17
18
19
20
21
22
23
24

export default {
  name: 'ToolBar',
  components: {
    UploadMedia,
  },
  data() {
    return {}
  },

Adam Procter's avatar
Adam Procter committed
25
26
27
28
29
  mixins: [
    shortcuts('n', function () {
      // n key pressed
      this.addNode()
    }),
Adam Procter's avatar
Adam Procter committed
30
31
    shortcuts('c', function () {
      // c key was pressed
ap2x07's avatar
ap2x07 committed
32
      console.log('c key was pressed')
Adam Procter's avatar
Adam Procter committed
33
34
35
    }),
  ],

36
37
38
  methods: {
    addNode() {
      this.$emit('added-node')
Adam Procter's avatar
Adam Procter committed
39
      this.$store.dispatch('addNode')
40
    },
Adam Procter's avatar
Adam Procter committed
41
42
43
44
45
46
47
48
49
    exitMicrocosm() {
    
      localStorage.removeItem('nogg_microcosm')
      localStorage.removeItem('nogg_name')

      location.assign(
        process.env.VUE_APP_HTTP + '://' + process.env.VUE_APP_URL + '/'
      )
    },
50
51
52
53
54
  },
}
</script>

<style scoped></style>