Moved movelock out of vuex

This commit is contained in:
Joel Collins 2019-05-08 17:50:10 +01:00
parent d83470a901
commit 56e43ae77f
2 changed files with 12 additions and 15 deletions

View file

@ -117,7 +117,8 @@ export default {
stepXy: 200,
stepZz: 50,
setPosition: this.$store.state.apiState.stage.position,
isAutofocusing: false
isAutofocusing: false,
moveLock: false
}
},
@ -190,9 +191,9 @@ export default {
moveRequest: function(x, y, z, absolute) {
// If not movement-locked
if (!this.$store.state.moveLock) {
if (!this.moveLock) {
// Lock move requests
this.$store.commit('changeMoveLock', true)
this.moveLock = true
// Send move request
axios.post(this.positionApiUri, {
@ -209,15 +210,15 @@ export default {
this.modalError(error) // Let mixin handle error
})
.then(() => {
this.$store.commit('changeMoveLock', false) // Release the move lock
this.moveLock = false // Release the move lock
})
}
},
runAutofocus: function(dz) {
if (!this.$store.state.moveLock) {
if (!this.moveLock) {
// Lock move requests
this.$store.commit('changeMoveLock', true);
this.moveLock = true
this.isAutofocusing = true
axios.post(this.autofocusApiUri, {dz: dz})
.then(response => {
@ -234,15 +235,15 @@ export default {
.finally(() => {
console.log("Cleaning up after autofocus.")
this.isAutofocusing = false;
this.$store.commit('changeMoveLock', false); // Release the move lock
this.moveLock = false // Release the move lock
})
}
},
runFastAutofocus: function(dz, backlash) {
if (!this.$store.state.moveLock) {
if (!this.moveLock) {
// Lock move requests
this.$store.commit('changeMoveLock', true);
this.moveLock = true
this.isAutofocusing = true
axios.post(this.fastAutofocusApiUri, {dz: dz, backlash: backlash})
.then(response => {
@ -258,8 +259,8 @@ export default {
})
.finally(() => {
console.log("Cleaning up after autofocus.")
this.isAutofocusing = false;
this.$store.commit('changeMoveLock', false); // Release the move lock
this.isAutofocusing = false
this.moveLock = false // Release the move lock
})
}
}

View file

@ -15,7 +15,6 @@ export default new Vuex.Store({
error: '',
apiConfig: {},
apiState: {},
moveLock: false,
settings: {
disableStream: false,
autoGpuPreview: false,
@ -35,9 +34,6 @@ export default new Vuex.Store({
changeWaiting(state, waiting) {
state.waiting = waiting
},
changeMoveLock(state, lock) {
state.moveLock = lock
},
commitError(state, errorString) {
state.error = errorString;
},