Commit 56e43ae7 authored by Joel Collins's avatar Joel Collins
Browse files

Moved movelock out of vuex

parent d83470a9
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -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
        })
      }
    }
+0 −4
Original line number Diff line number Diff line
@@ -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;
    },