fix: Only show PTZ controls for selected camera in grid mode (#1619)

This commit is contained in:
Dermot Duffy
2024-10-05 14:17:34 -07:00
committed by GitHub
parent 632e06b7f9
commit abcba34a3f
3 changed files with 37 additions and 23 deletions
+8 -3
View File
@@ -581,10 +581,15 @@ export class FrigateCardLiveCarousel extends LitElement {
const cameraMetadataPrevious = prevID
? this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(prevID, view))
: null;
const cameraID = this.viewFilterCameraID ?? view.camera;
const cameraMetadataNext = nextID
? this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(nextID, view))
: null;
const forcePTZVisibility =
!this._mediaHasLoaded ||
this.viewFilterCameraID !== view.camera ||
view.context?.ptzControls?.enabled === false
? false
: view.context?.ptzControls?.enabled;
// Notes on the below:
// - guard() is used to avoid reseting the carousel unless the
@@ -642,8 +647,8 @@ export class FrigateCardLiveCarousel extends LitElement {
<frigate-card-ptz
.config=${this.overriddenLiveConfig.controls.ptz}
.cameraManager=${this.cameraManager}
.cameraID=${getStreamCameraID(view, cameraID)}
.forceVisibility=${this._mediaHasLoaded && view.context?.ptzControls?.enabled}
.cameraID=${getStreamCameraID(view, this.viewFilterCameraID)}
.forceVisibility=${forcePTZVisibility}
>
</frigate-card-ptz>
`;