Cleaned up store and removed unused FoV setting

This commit is contained in:
Joel Collins 2020-11-22 16:52:30 +00:00
parent f187a3a00d
commit a1ae94792e
13 changed files with 42 additions and 119 deletions

View file

@ -1,18 +0,0 @@
// Theming specific to the electron app
.menubar-menu-container {
box-shadow: 0.5px 1px 4px 0px rgba(0, 0, 0, 0.3) !important;
}
.menubar-menu-container>* {
box-shadow: none !important;
}
.menubar-menu-container .action-menu-item,
.menubar-menu-container .action-label {
cursor: default
}
.menubar-menu-container a:hover {
text-decoration: none;
}

View file

@ -4,9 +4,6 @@
// Highlight.js
@import "./highlight.less";
// Electron app theming
@import "./app.less";
// Custom OpenFlexure theming
//

View file

@ -267,9 +267,9 @@ export default {
window.location.hostname
)
) {
this.$store.commit("changeSetting", ["disableStream", true]);
this.$store.commit("changeSetting", ["autoGpuPreview", true]);
this.$store.commit("changeSetting", ["trackWindow", true]);
this.$store.commit("changeDisableStream", true);
this.$store.commit("changeAutoGpuPreview", true);
this.$store.commit("changeTrackWindow", true);
}
// Update plugins
this.updatePlugins().then(() => {

View file

@ -242,7 +242,7 @@
</li>
</ul>
<div v-if="scanCapture" class="uk-margin uk-margin-remove-top ">
<div v-if="scanCapture" class="uk-margin uk-margin-remove-top">
<taskSubmitter
:submit-url="scanUri"
:submit-data="scanPayload"
@ -296,9 +296,9 @@ export default {
scanStyle: "Raster",
namingStyle: "Coordinates",
scanStepSize: {
x: 0,
y: 0,
z: 0
x: 800,
y: 640,
z: 50
},
scanSteps: {
x: 3,
@ -326,9 +326,6 @@ export default {
pluginsUri: function() {
return `${this.$store.getters.baseUri}/api/v2/extensions`;
},
settingsFovUri: function() {
return `${this.$store.getters.baseUri}/api/v2/instrument/settings/fov`;
},
basePayload: function() {
var payload = {};
@ -395,7 +392,6 @@ export default {
mounted() {
this.updateScanUri();
this.updateScanStepSize();
// A global signal listener to perform a capture action
this.$root.$on("globalCaptureEvent", () => {
this.handleCapture();
@ -439,21 +435,6 @@ export default {
});
},
updateScanStepSize: function() {
axios
.get(this.settingsFovUri) // Get the microscope FOV
.then(response => {
this.scanStepSize = {
x: parseInt(0.5 * response.data[0]),
y: parseInt(0.5 * response.data[1]),
z: 50
};
})
.catch(error => {
this.modalError(error); // Let mixin handle error
});
},
onScanSubmit: function() {},
onScanResponse: function(responseData) {

View file

@ -29,7 +29,7 @@ export default {
return this.$store.state.globalSettings.appTheme;
},
set(value) {
this.$store.commit("changeSetting", ["appTheme", value]);
this.$store.commit("changeAppTheme", value);
}
}
},

View file

@ -32,7 +32,7 @@ export default {
return this.$store.state.globalSettings.IHIEnabled;
},
set(value) {
this.$store.commit("changeSetting", ["IHIEnabled", value]);
this.$store.commit("changeIHIEnabled", value);
this.$root.$emit("globalSafeTogglePreview", value);
}
}

View file

@ -64,7 +64,7 @@ export default {
return this.$store.state.globalSettings.disableStream;
},
set(value) {
this.$store.commit("changeSetting", ["disableStream", value]);
this.$store.commit("changeDisableStream", value);
}
},
@ -73,7 +73,7 @@ export default {
return this.$store.state.globalSettings.autoGpuPreview;
},
set(value) {
this.$store.commit("changeSetting", ["autoGpuPreview", value]);
this.$store.commit("changeAutoGpuPreview", value);
this.$root.$emit("globalSafeTogglePreview", value);
}
},
@ -83,7 +83,7 @@ export default {
return this.$store.state.globalSettings.trackWindow;
},
set(value) {
this.$store.commit("changeSetting", ["trackWindow", value]);
this.$store.commit("changeTrackWindow", value);
}
}
}

View file

@ -46,7 +46,6 @@ export default {
isVisible: false,
displaySize: [0, 0],
displayPosition: [0, 0],
fov: [0, 0],
resizeTimeoutId: setTimeout(this.doneResizing, 500)
};
},
@ -104,8 +103,6 @@ export default {
console.log(`${this._uid} created`);
// Send a request to start/stop GPU preview based on global setting
this.safePreviewRequest(this.$store.state.globalSettings.autoGpuPreview);
// Get FOV from settings
this.updateFov();
},
beforeDestroy: function() {
@ -136,7 +133,7 @@ export default {
},
clickMonitor: function(event) {
// Calculate steps from event coordinates and store config FOV
// Calculate steps from event coordinates
let xCoordinate = event.offsetX;
let yCoordinate = event.offsetY;
@ -299,21 +296,6 @@ export default {
this.modalError(error); // Let mixin handle error
});
}
},
updateFov: function() {
console.log("Updating FOV");
// Get the current field-of-view setting from the server
axios
.get(`${this.settingsUri}/fov`)
.then(response => {
if (response.data) {
this.fov = response.data;
}
})
.catch(error => {
this.modalError(error); // Let mixin handle error
});
}
}
};

View file

@ -9,13 +9,11 @@ export default new Vuex.Store({
available: false,
waiting: false,
error: "",
globalSettings: {
disableStream: false,
autoGpuPreview: false,
trackWindow: true,
IHIEnabled: false,
appTheme: "system"
},
disableStream: false,
autoGpuPreview: false,
trackWindow: true,
IHIEnabled: false,
appTheme: "system",
activeStreams: {}
},
@ -26,8 +24,20 @@ export default new Vuex.Store({
changeWaiting(state, waiting) {
state.waiting = waiting;
},
changeSetting(state, [key, value]) {
state.globalSettings[key] = value;
changeDisableStream(state, disabled) {
state.disableStream = disabled;
},
changeAutoGpuPreview(state, enabled) {
state.autoGpuPreview = enabled;
},
changeTrackWindow(state, enabled) {
state.trackWindow = enabled;
},
changeAppTheme(state, theme) {
state.appTheme = theme;
},
changeIHIEnabled(state, enabled) {
state.IHIEnabled = enabled;
},
resetState(state) {
state.waiting = false;