fix(cctv): keep the camera card's bigger view refreshing

An open bigger view now counts as a viewer of the camera's still, so it
keeps refreshing after the layout turns phone and the Cameras sheet is
not the one open. The card releases it in the watcher's cleanup, which
also runs when the card unmounts in the same tick the popup closes.
This commit is contained in:
German Khokhlov committed 2026-11-20 03:35:32 +04:00
1 parent d19ae89630
commit 2c5f9f89f7
5 files changed
+142 -12

No files matched your search

+9
View File
@@ -22,6 +22,8 @@ export const useCctvStore = defineStore('gev-cctv', () => {
const frame = shallowRef(null);
/** Number of camera cards outside the panel showing its preview, including Context's card. */
const previewCards = shallowRef(0);
/** Number of open bigger views of a camera card (popups over the map). */
const previewPopups = shallowRef(0);
/** Whether the live video surface replaces the still frame. */
const live = shallowRef(false);
/** `{label, state}` for the source badge; null until first synced. */
@@ -56,6 +58,11 @@ export const useCctvStore = defineStore('gev-cctv', () => {
previewCards.value = Math.max(0, previewCards.value + (shown ? 1 : -1));
}
/** @param {boolean} shown */
function showPreviewPopup(shown) {
previewPopups.value = Math.max(0, previewPopups.value + (shown ? 1 : -1));
}
/** @param {boolean} on */
function setLive(on) {
live.value = Boolean(on);
@@ -81,6 +88,7 @@ export const useCctvStore = defineStore('gev-cctv', () => {
calEdit,
frame,
previewCards,
previewPopups,
live,
sourceBadge,
summary,
@@ -89,6 +97,7 @@ export const useCctvStore = defineStore('gev-cctv', () => {
setCalEdit,
setFrame,
showPreviewCard,
showPreviewPopup,
setLive,
setSourceBadge,
setSummary,