Refactor camera initialization into the camera engines.
This commit is contained in:
+3
-30
@@ -1,10 +1,5 @@
|
||||
import { ViewContext } from 'view';
|
||||
import {
|
||||
FrigateCardUserSpecifiedView,
|
||||
FrigateCardView,
|
||||
FRIGATE_CARD_VIEWS_USER_SPECIFIED,
|
||||
FRIGATE_CARD_VIEW_DEFAULT,
|
||||
} from '../types.js';
|
||||
import { FrigateCardView } from '../types.js';
|
||||
import { dispatchFrigateCardEvent } from '../utils/basic.js';
|
||||
import { MediaQueries } from './media-queries';
|
||||
import { MediaQueriesResults } from './media-queries-results';
|
||||
@@ -37,28 +32,6 @@ export class View {
|
||||
this.context = params.context ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects the best view for a non-Frigate camera.
|
||||
* @param view The wanted view.
|
||||
* @returns The closest view supported by the non-Frigate camera.
|
||||
*/
|
||||
public static selectBestViewForNonFrigateCameras(view: FrigateCardView) {
|
||||
return ['timeline', 'image'].includes(view) ? view : FRIGATE_CARD_VIEW_DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects the best view for a user specified view.
|
||||
* @param view The wanted view.
|
||||
* @returns The closest view supported that is user changeable.
|
||||
*/
|
||||
public static selectBestViewForUserSpecified(view: FrigateCardView) {
|
||||
return FRIGATE_CARD_VIEWS_USER_SPECIFIED.includes(
|
||||
view as FrigateCardUserSpecifiedView,
|
||||
)
|
||||
? view
|
||||
: FRIGATE_CARD_VIEW_DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect if a view change represents a major "media change" for the given
|
||||
* view.
|
||||
@@ -138,8 +111,8 @@ export class View {
|
||||
/**
|
||||
* Determine if current view matches a named view.
|
||||
*/
|
||||
public is(name: string): boolean {
|
||||
return this.view == name;
|
||||
public is(view: FrigateCardView): boolean {
|
||||
return this.view == view;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user