ui_migration fix(deps): --preliminary-- fixed replaced v-observe-visibility by vueuse useIntersectionObserver
This commit is contained in:
parent
5825015aba
commit
5fe3d563f5
33 changed files with 154 additions and 80 deletions
|
|
@ -2,7 +2,6 @@
|
|||
<div
|
||||
id="stream-display"
|
||||
ref="streamDisplay"
|
||||
v-observe-visibility="visibilityChanged"
|
||||
class="stream-display uk-width-1-1 uk-height-1-1 scrollTarget"
|
||||
>
|
||||
<img
|
||||
|
|
@ -16,6 +15,9 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
//vue3 migration
|
||||
import { useIntersectionObserver } from '@vueuse/core';
|
||||
|
||||
// Export main app
|
||||
export default {
|
||||
name: "MiniStreamDisplay",
|
||||
|
|
@ -31,10 +33,17 @@ export default {
|
|||
return `${this.$store.getters.baseUri}/camera/mjpeg_stream`;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
visibilityChanged(isVisible) {
|
||||
this.isVisible = isVisible;
|
||||
},
|
||||
|
||||
mounted() {
|
||||
useIntersectionObserver(
|
||||
this.$refs.streamDisplay,
|
||||
([{ isIntersecting }]) => {
|
||||
this.isVisible = isIntersecting;
|
||||
},
|
||||
{
|
||||
threshold: 0.0,
|
||||
}
|
||||
);
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<template>
|
||||
<div v-observe-visibility="visibilityChanged" class="uk-margin-remove uk-padding-remove">
|
||||
<div class="uk-margin-remove uk-padding-remove">
|
||||
<button
|
||||
ref="actionButton"
|
||||
type="button"
|
||||
:disabled="buttonDisabled"
|
||||
class="uk-button uk-width-1-1 uk-position-relative"
|
||||
|
|
@ -28,8 +29,10 @@
|
|||
<script>
|
||||
import ActionProgressBar from "./actionProgressBar.vue";
|
||||
import ActionStatusModal from "./actionStatusModal.vue";
|
||||
import { markRaw } from "vue";
|
||||
//vue3 migration
|
||||
import { eventBus } from "../../eventBus.js";
|
||||
import { useIntersectionObserver } from "@vueuse/core";
|
||||
|
||||
|
||||
export default {
|
||||
name: "ActionButton",
|
||||
|
|
@ -155,20 +158,16 @@ export default {
|
|||
handler(newval) {
|
||||
this.$emit("update:progress", newval);
|
||||
},
|
||||
//deep: true,
|
||||
immediate: true // Optional: triggers immediately on component load
|
||||
},
|
||||
taskStarted: {
|
||||
handler(newval) {
|
||||
this.$emit("update:taskStarted", newval);
|
||||
},
|
||||
//deep: true
|
||||
},
|
||||
taskRunning: {
|
||||
handler(newval) {
|
||||
this.$emit("update:taskRunning", newval);
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
log: {
|
||||
handler(newval) {
|
||||
|
|
@ -180,11 +179,20 @@ export default {
|
|||
handler(newval) {
|
||||
this.$emit("update:taskStatus", newval);
|
||||
},
|
||||
//deep: true
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
useIntersectionObserver(
|
||||
this.$refs.actionButton,
|
||||
([{ isIntersecting }]) => {
|
||||
this.visibilityChanged(isIntersecting);
|
||||
},
|
||||
{
|
||||
threshold: 0.0, // Adjust as needed
|
||||
},
|
||||
);
|
||||
|
||||
// Check for already running tasks
|
||||
if (this.taskStarted != true) {
|
||||
this.checkExistingTasks();
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import UIkit from "uikit";
|
|||
import ActionProgressBar from "./actionProgressBar.vue";
|
||||
import ActionLogDisplay from "./actionLogDisplay.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
import { eventBus } from "../../eventBus.js";
|
||||
|
||||
export default {
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@
|
|||
<script>
|
||||
import syncPropertyButton from "./syncPropertyButton.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
|
||||
export default {
|
||||
name: "InputFromSchema",
|
||||
|
|
@ -216,13 +215,11 @@ export default {
|
|||
this.updateIsEdited();
|
||||
this.resetInternalValue();
|
||||
},
|
||||
//deep: true,
|
||||
},
|
||||
internalValue: {
|
||||
handler() {
|
||||
this.updateIsEdited();
|
||||
},
|
||||
//deep: true,
|
||||
},
|
||||
animate(updated) {
|
||||
if (updated) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
import { formatValue } from "@/js_utils/formatter.mjs";
|
||||
import InputFromSchema from "./inputFromSchema.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
|
||||
|
||||
export default {
|
||||
name: "PropertyControl",
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
<script>
|
||||
import ActionButton from "./actionButton.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
|
||||
// Export main app
|
||||
export default {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
<script>
|
||||
import PropertyControl from "./propertyControl.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
|
||||
// Export main app
|
||||
export default {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,13 @@ import finalStep from "./calibrationWizardComponents/finalStep.vue";
|
|||
export default {
|
||||
name: "CalibrationWizard",
|
||||
|
||||
components: {},
|
||||
components: {
|
||||
singleStepTask,
|
||||
welcomeStep,
|
||||
cameraCalibrationTask,
|
||||
cameraStageMappingTask,
|
||||
finalStep
|
||||
},
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
import stepTemplateWithStream from "../stepTemplateWithStream.vue";
|
||||
import cameraCalibrationSettings from "../../../tabContentComponents/settingsComponents/cameraSettingsComponents/cameraCalibrationSettings.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
|
||||
export default {
|
||||
name: "CameraMainCalibrationStep",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
import stepTemplateWithStream from "../stepTemplateWithStream.vue";
|
||||
import ActionButton from "../../../labThingsComponents/actionButton.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
|
||||
export default {
|
||||
name: "CameraMainCalibrationStep",
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
import stepTemplateWithStream from "../stepTemplateWithStream.vue";
|
||||
import CSMCalibrationSettings from "../../../tabContentComponents/settingsComponents/CSMSettingsComponents/CSMCalibrationSettings.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
|
||||
export default {
|
||||
name: "CameraMainCalibrationStep",
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
<script>
|
||||
import miniStreamDisplay from "../../genericComponents/miniStreamDisplay.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
|
||||
export default {
|
||||
name: "StepTemplateWithStream",
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@
|
|||
<script>
|
||||
import ActionButton from "../../labThingsComponents/actionButton.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
|
||||
export default {
|
||||
name: "StatusPane",
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
import devTools from "./aboutComponents/devTools.vue";
|
||||
import statusPane from "./aboutComponents/statusPane.vue";
|
||||
//vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
|
||||
export default {
|
||||
name: "AboutContent",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div v-observe-visibility="visibilityChanged" class="uk-padding-small">
|
||||
<div ref="backgroundDetectContent" class="uk-padding-small">
|
||||
<div>
|
||||
<ul uk-accordion="multiple: true">
|
||||
<li>
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
import ActionButton from "../../labThingsComponents/actionButton.vue";
|
||||
import ServerSpecifiedPropertyControl from "../../labThingsComponents/serverSpecifiedPropertyControl.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
import { useIntersectionObserver } from "@vueuse/core";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
|
@ -107,6 +107,18 @@ export default {
|
|||
}
|
||||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
useIntersectionObserver(
|
||||
this.$refs.backgroundDetectContent,
|
||||
([{ isIntersecting }]) => {
|
||||
this.visibilityChanged(isIntersecting);
|
||||
},
|
||||
{
|
||||
threshold: 0.0,
|
||||
},
|
||||
);
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
import paneBackgroundDetect from "./backgroundDetectComponents/paneBackgroundDetect";
|
||||
import streamDisplay from "./streamContent.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
|
||||
export default {
|
||||
name: "BackgroundDetectContent",
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
<script>
|
||||
import ActionButton from "../../labThingsComponents/actionButton.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
import { eventBus } from "../../../eventBus.js";
|
||||
|
||||
export default {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import ActionButton from "../../labThingsComponents/actionButton.vue";
|
|||
import positionControl from "./positionControl.vue";
|
||||
import autofocusControl from "./autofocusControl.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
|
||||
export default {
|
||||
name: "PaneControl",
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ import ActionButton from "../../labThingsComponents/actionButton.vue";
|
|||
import syncPropertyButton from "../../labThingsComponents/syncPropertyButton.vue";
|
||||
import stageControlButtons from "./stageControlButtons.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
import { eventBus } from "../../../eventBus.js";
|
||||
|
||||
export default {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
import paneControl from "./controlComponents/paneControl.vue";
|
||||
import streamDisplay from "./streamContent.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
|
||||
export default {
|
||||
name: "ControlContent",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div v-observe-visibility="visibilityChanged" class="uk-padding uk-padding-remove-top">
|
||||
<div ref="loggingDisplay" class="uk-padding uk-padding-remove-top">
|
||||
<!-- Logging nav bar -->
|
||||
<nav class="logging-navbar uk-navbar-container uk-navbar-transparent" uk-navbar="mode: click">
|
||||
<!-- Left side controls -->
|
||||
|
|
@ -84,7 +84,7 @@ import axios from "axios";
|
|||
import Paginate from "vuejs-paginate";
|
||||
import EndpointButton from "../labThingsComponents/endpointButton.vue";
|
||||
//vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
import { useIntersectionObserver } from "@vueuse/core";
|
||||
|
||||
export default {
|
||||
name: "LoggingContent",
|
||||
|
|
@ -135,6 +135,18 @@ export default {
|
|||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
useIntersectionObserver(
|
||||
this.$refs.loggingDisplay,
|
||||
([{ isIntersecting }]) => {
|
||||
this.visibilityChanged(isIntersecting);
|
||||
},
|
||||
{
|
||||
threshold: 0.0,
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
methods: {
|
||||
scrollToTop() {
|
||||
this.$emit("scrollTop");
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
<template>
|
||||
<div v-observe-visibility="visibilityChanged">
|
||||
<div ref="osdViewerContainer" class="osd-viewer-container uk-height-1-1">
|
||||
<div id="openseadragon" ref="osdContainer"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import OpenSeaDragon from "openseadragon";
|
||||
// vue3 migration
|
||||
import { useIntersectionObserver } from "@vueuse/core";
|
||||
|
||||
export default {
|
||||
name: "OpenSeadragonViewer",
|
||||
|
|
@ -37,7 +39,6 @@ export default {
|
|||
|
||||
watch: {
|
||||
src: {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
handler(newVal) {
|
||||
this.loadOpenSeaDragon(newVal);
|
||||
|
|
@ -55,6 +56,14 @@ export default {
|
|||
},
|
||||
|
||||
async mounted() {
|
||||
useIntersectionObserver(
|
||||
this.$refs.osdViewerContainer,
|
||||
([{ isIntersecting }]) => {
|
||||
this.visibilityChanged(isIntersecting);
|
||||
},
|
||||
{ threshold: 0.0 }
|
||||
);
|
||||
|
||||
if (this.src) {
|
||||
this.loadOpenSeaDragon(this.src);
|
||||
}
|
||||
|
|
@ -62,17 +71,28 @@ export default {
|
|||
|
||||
beforeUnmount() {
|
||||
// Remove global signal listener to perform a gallery refresh
|
||||
this.osdViewer.destroy();
|
||||
if (this.osdViewer) {
|
||||
this.osdViewer.destroy();
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
visibilityChanged(isVisible) {
|
||||
// adding this check to avoid error when the viewer is not yet initialized.
|
||||
if (isVisible) {
|
||||
this.loadOpenSeaDragon();
|
||||
|
||||
if (!this.osdViewer && this.src) {
|
||||
this.loadOpenSeaDragon(this.src);
|
||||
}
|
||||
} else {
|
||||
this.osdViewer.destroy();
|
||||
|
||||
if (this.osdViewer) {
|
||||
this.osdViewer.destroy();
|
||||
this.osdViewer = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async loadOpenSeaDragon() {
|
||||
if (this.osdViewer) {
|
||||
this.osdViewer.destroy();
|
||||
|
|
|
|||
|
|
@ -83,7 +83,6 @@ import axios from "axios";
|
|||
import actionButton from "../../labThingsComponents/actionButton.vue";
|
||||
import EndpointButton from "../../labThingsComponents/endpointButton.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
|
||||
// Export main app
|
||||
export default {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@
|
|||
import UIkit from "uikit";
|
||||
import OpenSeadragonViewer from "./openSeadragonViewer.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
|
||||
export default {
|
||||
name: "ScanViewerModal",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div
|
||||
v-observe-visibility="visibilityChanged"
|
||||
ref="galleryDisplay"
|
||||
class="galleryDisplay uk-padding uk-padding-remove-top"
|
||||
>
|
||||
<!-- Gallery nav bar -->
|
||||
|
|
@ -101,8 +101,8 @@ import actionButton from "../labThingsComponents/actionButton.vue";
|
|||
import scanCard from "./scanListComponents/scanCard.vue";
|
||||
import ScanViewerModal from "./scanListComponents/scanViewer.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
import { eventBus } from "../../eventBus.js";
|
||||
import { useIntersectionObserver } from "@vueuse/core";
|
||||
|
||||
// Export main app
|
||||
export default {
|
||||
|
|
@ -148,6 +148,15 @@ export default {
|
|||
},
|
||||
|
||||
async mounted() {
|
||||
useIntersectionObserver(
|
||||
this.$refs.galleryDisplay,
|
||||
([{ isIntersecting }]) => {
|
||||
this.visibilityChanged(isIntersecting);
|
||||
},
|
||||
{
|
||||
threshold: 0.0, // Adjust as needed
|
||||
},
|
||||
);
|
||||
// Update on mount (does nothing if not connected)
|
||||
await this.updateScans();
|
||||
// A global signal listener to perform a gallery refresh
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
import CSMCalibrationSettings from "./CSMSettingsComponents/CSMCalibrationSettings.vue";
|
||||
import miniStreamDisplay from "../../genericComponents/miniStreamDisplay.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
|
||||
// Export main app
|
||||
export default {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div id="CSMCalibrationSettings" v-observe-visibility="visibilityChanged">
|
||||
<div id="CSMCalibrationSettings" ref="CSMCalibrationSettingsContainer" class="uk-width-large">
|
||||
<!--Show auto calibrate if default plugin is enabled-->
|
||||
<div v-if="'calibrate_xy' in actions" class="uk-margin-small">
|
||||
<action-button
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
import ActionButton from "@/components/labThingsComponents/actionButton.vue";
|
||||
import matrixDisplay from "@/components/ui/matrixDisplay.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
import { useIntersectionObserver } from "@vueuse/core";
|
||||
|
||||
// Export main app
|
||||
export default {
|
||||
|
|
@ -95,6 +95,16 @@ export default {
|
|||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
useIntersectionObserver(
|
||||
this.$refs.CSMCalibrationSettingsContainer,
|
||||
([{ isIntersecting }]) => {
|
||||
this.visibilityChanged(isIntersecting);
|
||||
},
|
||||
{ threshold: 0.0 }
|
||||
);
|
||||
},
|
||||
|
||||
methods: {
|
||||
visibilityChanged(isVisible) {
|
||||
if (isVisible) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import cameraCalibrationSettings from "./cameraSettingsComponents/cameraCalibrat
|
|||
import miniStreamDisplay from "../../genericComponents/miniStreamDisplay.vue";
|
||||
import ServerSpecifiedPropertyControl from "../../labThingsComponents/serverSpecifiedPropertyControl.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
|
||||
// Export main app
|
||||
export default {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export default {
|
|||
name: "CameraCalibrationSettings",
|
||||
|
||||
components: {
|
||||
ServerSpecifiedActionButton,
|
||||
ServerSpecifiedActionButton
|
||||
},
|
||||
|
||||
props: {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
<script>
|
||||
import appSettings from "./displaySetttingsComponents/appSettings.vue";
|
||||
import streamSettings from "./displaySetttingsComponents/streamSettings.vue";
|
||||
import { markRaw } from "vue";
|
||||
|
||||
// Export main app
|
||||
export default {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div id="stageSettings" v-observe-visibility="visibilityChanged" class="uk-width-large">
|
||||
<div id="stageSettings" ref="stageSettingsContainer" class="uk-width-large">
|
||||
The microscope stage is a <b>{{ stageType }}</b>
|
||||
<div>
|
||||
<div class="uk-margin">
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
<script>
|
||||
import ActionButton from "../../labThingsComponents/actionButton.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
import { useIntersectionObserver } from "@vueuse/core";
|
||||
|
||||
export default {
|
||||
name: "StageSettings",
|
||||
|
|
@ -51,6 +51,16 @@ export default {
|
|||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
useIntersectionObserver(
|
||||
this.$refs.stageSettingsContainer,
|
||||
([{ isIntersecting }]) => {
|
||||
this.visibilityChanged(isIntersecting);
|
||||
},
|
||||
{ threshold: 0.0 }
|
||||
);
|
||||
},
|
||||
|
||||
methods: {
|
||||
visibilityChanged(isVisible) {
|
||||
if (isVisible) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div uk-grid class="uk-height-1-1 uk-margin-remove uk-padding-remove">
|
||||
<div class="control-component uk-padding-small">
|
||||
<div v-show="!scanning" v-observe-visibility="visibilityChanged" class="uk-padding-small">
|
||||
<div v-show="!scanning" ref="slideScanContent" class="uk-padding-small">
|
||||
<h4 v-if="workflowDisplayName" class="workflow-name">
|
||||
{{ workflowDisplayName }}
|
||||
</h4>
|
||||
|
|
@ -117,7 +117,7 @@ import actionProgressBar from "../labThingsComponents/actionProgressBar.vue";
|
|||
import MiniStreamDisplay from "../genericComponents/miniStreamDisplay.vue";
|
||||
import ActionButton from "../labThingsComponents/actionButton.vue";
|
||||
// vue3 migration
|
||||
import { markRaw } from "vue";
|
||||
import { useIntersectionObserver } from "@vueuse/core";
|
||||
|
||||
export default {
|
||||
name: "SlideScanContent",
|
||||
|
|
@ -129,6 +129,7 @@ export default {
|
|||
actionProgressBar,
|
||||
MiniStreamDisplay,
|
||||
ActionButton,
|
||||
ServerSpecifiedPropertyControl
|
||||
},
|
||||
|
||||
data() {
|
||||
|
|
@ -162,6 +163,18 @@ export default {
|
|||
this.readSettings();
|
||||
},
|
||||
|
||||
mounted() {
|
||||
useIntersectionObserver(
|
||||
this.$refs.slideScanContent,
|
||||
([{ isIntersecting }]) => {
|
||||
this.visibilityChanged(isIntersecting);
|
||||
},
|
||||
{
|
||||
threshold: 0.0, // Adjust as needed
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
methods: {
|
||||
visibilityChanged(isVisible) {
|
||||
if (isVisible) {
|
||||
|
|
|
|||
|
|
@ -36,42 +36,21 @@
|
|||
<script>
|
||||
// vue3 migration
|
||||
import { eventBus } from "../../eventBus.js";
|
||||
import { ref } from "vue";
|
||||
import { useIntersectionObserver } from "@vueuse/core";
|
||||
|
||||
// Export main app
|
||||
export default {
|
||||
name: "StreamDisplay",
|
||||
|
||||
setup() {
|
||||
|
||||
const streamDisplay = ref(null);
|
||||
const isVisible = ref(false);
|
||||
|
||||
useIntersectionObserver(
|
||||
streamDisplay,
|
||||
([{ isIntersecting }]) => {
|
||||
isVisible.value = isIntersecting;
|
||||
},
|
||||
{
|
||||
threshold: 0.1,
|
||||
}
|
||||
);
|
||||
|
||||
return {
|
||||
streamDisplay,
|
||||
isVisible,
|
||||
};
|
||||
},
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
isVisible: false,
|
||||
displaySize: [0, 0],
|
||||
displayPosition: [0, 0],
|
||||
resizeTimeoutId: setTimeout(this.doneResizing, 500),
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
computed: {
|
||||
streamEnabled: function () {
|
||||
return this.$store.getters.ready && !this.$store.state.disableStream;
|
||||
|
|
@ -86,12 +65,23 @@ export default {
|
|||
},
|
||||
|
||||
mounted() {
|
||||
//set up an intersection observer
|
||||
useIntersectionObserver(
|
||||
this.$refs.streamDisplay,
|
||||
([{ isIntersecting }]) => {
|
||||
this.isVisible = isIntersecting;
|
||||
},
|
||||
{
|
||||
threshold: 0.0,
|
||||
}
|
||||
);
|
||||
// A global signal listener to flash the stream element
|
||||
this.onFlashStream = () => {
|
||||
this.flashStream();
|
||||
};
|
||||
|
||||
eventBus.on("globalFlashStream", this.onFlashStream);
|
||||
|
||||
// Mutation observer
|
||||
this.sizeObserver = new ResizeObserver(() => {
|
||||
this.handleResize(); // For any element attached to the observer, run handleResize() on change
|
||||
|
|
@ -120,9 +110,6 @@ export default {
|
|||
},
|
||||
|
||||
methods: {
|
||||
visibilityChanged(isVisible) {
|
||||
this.isVisible = isVisible;
|
||||
},
|
||||
flashStream: function () {
|
||||
// Run an animation that flashes the stream (for capture feedback)
|
||||
let element = this.$refs.streamDisplay;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue