Fixed global state and scrolltotop
This commit is contained in:
parent
a1ae94792e
commit
ef9f257e23
13 changed files with 34 additions and 50 deletions
|
|
@ -102,9 +102,9 @@ export default {
|
||||||
},
|
},
|
||||||
handleTheme: function() {
|
handleTheme: function() {
|
||||||
var isDark = false;
|
var isDark = false;
|
||||||
if (this.$store.state.globalSettings.appTheme == "dark") {
|
if (this.$store.state.appTheme == "dark") {
|
||||||
isDark = true;
|
isDark = true;
|
||||||
} else if (this.$store.state.globalSettings.appTheme == "system") {
|
} else if (this.$store.state.appTheme == "system") {
|
||||||
if (this.systemDark) {
|
if (this.systemDark) {
|
||||||
isDark = true;
|
isDark = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
enabledTopTabs: function() {
|
enabledTopTabs: function() {
|
||||||
var enabledTabs = this.topTabs;
|
var enabledTabs = this.topTabs;
|
||||||
if (this.$store.state.globalSettings.IHIEnabled) {
|
if (this.$store.state.IHIEnabled) {
|
||||||
enabledTabs.push({
|
enabledTabs.push({
|
||||||
id: "slidescan",
|
id: "slidescan",
|
||||||
icon: "settings_overscan",
|
icon: "settings_overscan",
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,12 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
if (!this.$store.getters.ready) {
|
||||||
|
this.currentOrigin = "http://microscope.local:5000";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
overrideAPIHost: function() {
|
overrideAPIHost: function() {
|
||||||
this.$store.commit("changeOrigin", this.currentOrigin);
|
this.$store.commit("changeOrigin", this.currentOrigin);
|
||||||
|
|
|
||||||
|
|
@ -308,7 +308,7 @@ export default {
|
||||||
resizeDims: [640, 480],
|
resizeDims: [640, 480],
|
||||||
tags: [],
|
tags: [],
|
||||||
annotations: {
|
annotations: {
|
||||||
Client: `${process.env.PACKAGE.name}.${process.env.PACKAGE.version}`
|
Client: "openflexure-microscope-jsclient:builtin"
|
||||||
},
|
},
|
||||||
scanUri: null
|
scanUri: null
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="capture-card uk-card uk-card-default uk-padding-remove uk-width-medium"
|
class="capture-card uk-card uk-card-default uk-padding-remove uk-width-medium"
|
||||||
:class="{ 'uk-card-secondary': $store.state.globalSettings.darkMode }"
|
:class="{ 'uk-card-secondary': $store.state.darkMode }"
|
||||||
>
|
>
|
||||||
<div class="uk-card-media-top">
|
<div class="uk-card-media-top">
|
||||||
<a class="lightbox-link" :href="imgURL" :data-caption="name">
|
<a class="lightbox-link" :href="imgURL" :data-caption="name">
|
||||||
|
|
@ -70,8 +70,7 @@
|
||||||
<div
|
<div
|
||||||
class="uk-modal-dialog uk-modal-body"
|
class="uk-modal-dialog uk-modal-body"
|
||||||
:class="{
|
:class="{
|
||||||
'uk-light uk-background-secondary':
|
'uk-light uk-background-secondary': $store.state.darkMode
|
||||||
$store.state.globalSettings.darkMode
|
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<button class="uk-modal-close-default" type="button" uk-close></button>
|
<button class="uk-modal-close-default" type="button" uk-close></button>
|
||||||
|
|
@ -112,8 +111,7 @@
|
||||||
<form
|
<form
|
||||||
class="uk-modal-dialog uk-modal-body uk-margin-auto-vertical"
|
class="uk-modal-dialog uk-modal-body uk-margin-auto-vertical"
|
||||||
:class="{
|
:class="{
|
||||||
'uk-light uk-background-secondary':
|
'uk-light uk-background-secondary': $store.state.darkMode
|
||||||
$store.state.globalSettings.darkMode
|
|
||||||
}"
|
}"
|
||||||
@submit.prevent="handleTagSubmit"
|
@submit.prevent="handleTagSubmit"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,7 @@
|
||||||
<a href="#">Filter</a>
|
<a href="#">Filter</a>
|
||||||
<div
|
<div
|
||||||
:class="{
|
:class="{
|
||||||
'uk-light uk-background-secondary':
|
'uk-light uk-background-secondary': $store.state.darkMode
|
||||||
$store.state.globalSettings.darkMode
|
|
||||||
}"
|
}"
|
||||||
class="uk-navbar-dropdown"
|
class="uk-navbar-dropdown"
|
||||||
>
|
>
|
||||||
|
|
@ -342,7 +341,10 @@ export default {
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
scrollToTop() {
|
scrollToTop() {
|
||||||
document.querySelector("#container-left").scrollTop = 0;
|
const el = document.querySelector("#container-left");
|
||||||
|
if (el) {
|
||||||
|
el.scrollTop = 0;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateCaptures: function() {
|
updateCaptures: function() {
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,10 @@ export default {
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
scrollToTop() {
|
scrollToTop() {
|
||||||
document.querySelector("#container-left").scrollTop = 0;
|
const el = document.querySelector("#container-left");
|
||||||
|
if (el) {
|
||||||
|
el.scrollTop = 0;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
visibilityChanged(isVisible) {
|
visibilityChanged(isVisible) {
|
||||||
if (isVisible) {
|
if (isVisible) {
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
appTheme: {
|
appTheme: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.state.globalSettings.appTheme;
|
return this.$store.state.appTheme;
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
this.$store.commit("changeAppTheme", value);
|
this.$store.commit("changeAppTheme", value);
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
IHIEnabled: {
|
IHIEnabled: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.state.globalSettings.IHIEnabled;
|
return this.$store.state.IHIEnabled;
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
this.$store.commit("changeIHIEnabled", value);
|
this.$store.commit("changeIHIEnabled", value);
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
disableStream: {
|
disableStream: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.state.globalSettings.disableStream;
|
return this.$store.state.disableStream;
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
this.$store.commit("changeDisableStream", value);
|
this.$store.commit("changeDisableStream", value);
|
||||||
|
|
@ -70,7 +70,7 @@ export default {
|
||||||
|
|
||||||
autoGpuPreview: {
|
autoGpuPreview: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.state.globalSettings.autoGpuPreview;
|
return this.$store.state.autoGpuPreview;
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
this.$store.commit("changeAutoGpuPreview", value);
|
this.$store.commit("changeAutoGpuPreview", value);
|
||||||
|
|
@ -80,7 +80,7 @@ export default {
|
||||||
|
|
||||||
trackWindow: {
|
trackWindow: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.state.globalSettings.trackWindow;
|
return this.$store.state.trackWindow;
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
this.$store.commit("changeTrackWindow", value);
|
this.$store.commit("changeTrackWindow", value);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-else-if="$store.state.globalSettings.disableStream"
|
v-else-if="$store.state.disableStream"
|
||||||
class="uk-position-center position-relative text-center"
|
class="uk-position-center position-relative text-center"
|
||||||
>
|
>
|
||||||
Stream preview disabled
|
Stream preview disabled
|
||||||
|
|
@ -52,10 +52,7 @@ export default {
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
streamEnabled: function() {
|
streamEnabled: function() {
|
||||||
return (
|
return this.$store.getters.ready && !this.$store.state.disableStream;
|
||||||
this.$store.getters.ready &&
|
|
||||||
!this.$store.state.globalSettings.disableStream
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
thisStreamOpen: function() {
|
thisStreamOpen: function() {
|
||||||
// Only a single MJPEG connection should be open at a time
|
// Only a single MJPEG connection should be open at a time
|
||||||
|
|
@ -102,7 +99,7 @@ export default {
|
||||||
created: function() {
|
created: function() {
|
||||||
console.log(`${this._uid} created`);
|
console.log(`${this._uid} created`);
|
||||||
// Send a request to start/stop GPU preview based on global setting
|
// Send a request to start/stop GPU preview based on global setting
|
||||||
this.safePreviewRequest(this.$store.state.globalSettings.autoGpuPreview);
|
this.safePreviewRequest(this.$store.state.autoGpuPreview);
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy: function() {
|
beforeDestroy: function() {
|
||||||
|
|
@ -187,7 +184,7 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
console.log(`STREAM ${this._uid} OPEN`);
|
console.log(`STREAM ${this._uid} OPEN`);
|
||||||
this.$store.commit("addStream", this._uid);
|
this.$store.commit("addStream", this._uid);
|
||||||
if (this.$store.state.globalSettings.autoGpuPreview == true) {
|
if (this.$store.state.autoGpuPreview == true) {
|
||||||
// Start the preview immediately
|
// Start the preview immediately
|
||||||
this.safePreviewRequest(true);
|
this.safePreviewRequest(true);
|
||||||
// Send another start preview request after a timeout
|
// Send another start preview request after a timeout
|
||||||
|
|
@ -258,7 +255,7 @@ export default {
|
||||||
// If requesting starting the stream, but this component is inactive, skip
|
// If requesting starting the stream, but this component is inactive, skip
|
||||||
if (
|
if (
|
||||||
this.$store.getters.ready == true &&
|
this.$store.getters.ready == true &&
|
||||||
this.$store.state.globalSettings.autoGpuPreview == true
|
this.$store.state.autoGpuPreview == true
|
||||||
) {
|
) {
|
||||||
var requestUri = null;
|
var requestUri = null;
|
||||||
// Create URI
|
// Create URI
|
||||||
|
|
@ -270,10 +267,7 @@ export default {
|
||||||
|
|
||||||
// Generate payload if tracking window position
|
// Generate payload if tracking window position
|
||||||
var payload = {};
|
var payload = {};
|
||||||
if (
|
if (this.$store.state.trackWindow == true && state == true) {
|
||||||
this.$store.state.globalSettings.trackWindow == true &&
|
|
||||||
state == true
|
|
||||||
) {
|
|
||||||
// Recalculate frame dimensions and position
|
// Recalculate frame dimensions and position
|
||||||
this.recalculateSize();
|
this.recalculateSize();
|
||||||
// Copy data into payload array
|
// Copy data into payload array
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import App from "./App.vue";
|
||||||
import store from "./store";
|
import store from "./store";
|
||||||
import UIkit from "uikit";
|
import UIkit from "uikit";
|
||||||
import VueTour from "vue-tour";
|
import VueTour from "vue-tour";
|
||||||
import LoadScript from "vue-plugin-load-script";
|
|
||||||
import VueFriendlyIframe from "vue-friendly-iframe";
|
import VueFriendlyIframe from "vue-friendly-iframe";
|
||||||
import VueObserveVisibility from "vue-observe-visibility";
|
import VueObserveVisibility from "vue-observe-visibility";
|
||||||
|
|
||||||
|
|
@ -22,9 +21,6 @@ UIkit.mixin(
|
||||||
"accordion"
|
"accordion"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Use load-script module
|
|
||||||
Vue.use(LoadScript);
|
|
||||||
|
|
||||||
// Use vue-tour module
|
// Use vue-tour module
|
||||||
Vue.use(VueTour);
|
Vue.use(VueTour);
|
||||||
|
|
||||||
|
|
@ -58,7 +54,7 @@ Vue.mixin({
|
||||||
.finally(function() {
|
.finally(function() {
|
||||||
// Reenable the GPU preview, if it was active before the modal
|
// Reenable the GPU preview, if it was active before the modal
|
||||||
console.log("Re-enabling GPU preview");
|
console.log("Re-enabling GPU preview");
|
||||||
if (context.$store.state.globalSettings.autoGpuPreview) {
|
if (context.$store.state.autoGpuPreview) {
|
||||||
console.log("Re-enabling preview");
|
console.log("Re-enabling preview");
|
||||||
context.$root.$emit("globalTogglePreview", true);
|
context.$root.$emit("globalTogglePreview", true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
var webpack = require("webpack");
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
configureWebpack: {
|
|
||||||
plugins: [
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
"process.env": {
|
|
||||||
PACKAGE: JSON.stringify(require("./package.json"))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
publicPath: ""
|
|
||||||
};
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue