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

View file

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