Skip to content
Snippets Groups Projects
Commit 6cf0dae7 authored by Adam Procter's avatar Adam Procter
Browse files

Merge branch 'store'

parents d14845f9 b21de261
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex'
var canvas = null var canvas = null
export default { export default {
...@@ -27,24 +28,12 @@ export default { ...@@ -27,24 +28,12 @@ export default {
props: { props: {
msg: String msg: String
}, },
data: function() {
return { computed: mapState({
configRect: { configRect: state => state.configRect,
x: -25, configHandle: state => state.configHandle
y: -25, }),
height: 50,
width: 50,
fill: 'rgb(200, 0, 0)'
},
configHandle: {
x: 25,
y: 25,
height: 4,
width: 4,
fill: 'black'
}
}
},
mounted() { mounted() {
canvas = this.$refs.canvas canvas = this.$refs.canvas
this.ctx = canvas.getContext('2d') this.ctx = canvas.getContext('2d')
...@@ -53,7 +42,6 @@ export default { ...@@ -53,7 +42,6 @@ export default {
methods: { methods: {
draw() { draw() {
this.box(this.ctx, this.x, this.y) this.box(this.ctx, this.x, this.y)
console.log('draw')
}, },
box(ctx, x, y) { box(ctx, x, y) {
......
...@@ -4,7 +4,22 @@ import Vuex from 'vuex' ...@@ -4,7 +4,22 @@ import Vuex from 'vuex'
Vue.use(Vuex) Vue.use(Vuex)
export default new Vuex.Store({ export default new Vuex.Store({
state: {}, state: {
configRect: {
x: -25,
y: -25,
height: 50,
width: 50,
fill: 'rgb(200, 0, 0)'
},
configHandle: {
x: 25,
y: 25,
height: 4,
width: 4,
fill: 'black'
}
},
mutations: {}, mutations: {},
actions: {}, actions: {},
modules: {} modules: {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment