diff --git a/packages/autorotate-plugin/src/AutorotatePlugin.ts b/packages/autorotate-plugin/src/AutorotatePlugin.ts index f03d4692..9e39b7f5 100644 --- a/packages/autorotate-plugin/src/AutorotatePlugin.ts +++ b/packages/autorotate-plugin/src/AutorotatePlugin.ts @@ -174,7 +174,7 @@ export class AutorotatePlugin extends AbstractConfigurablePlugin< * Changes the keypoints * @throws {@link PSVError} if the configuration is invalid */ - setKeypoints(keypoints: AutorotateKeypoint[]) { + setKeypoints(keypoints: AutorotateKeypoint[] | null) { if (!keypoints) { this.keypoints = null; } else { diff --git a/packages/compass-plugin/src/CompassPlugin.ts b/packages/compass-plugin/src/CompassPlugin.ts index b15526f4..d5d4465b 100644 --- a/packages/compass-plugin/src/CompassPlugin.ts +++ b/packages/compass-plugin/src/CompassPlugin.ts @@ -124,7 +124,7 @@ export class CompassPlugin extends AbstractConfigurablePlugin< /** * Changes the hotspots on the compass */ - setHotspots(hotspots: CompassHotspot[]) { + setHotspots(hotspots: CompassHotspot[] | null) { this.config.hotspots = hotspots; this.component.update(); } diff --git a/packages/core/src/Viewer.ts b/packages/core/src/Viewer.ts index 90e68efa..10d275b5 100644 --- a/packages/core/src/Viewer.ts +++ b/packages/core/src/Viewer.ts @@ -375,7 +375,7 @@ export class Viewer extends TypedEventTarget { this.state.loadingPromise = null; if (err) { - this.navbar.setCaption(''); + this.navbar.setCaption(null); this.showError(this.config.lang.loadError); console.error(err); this.dispatchEvent(new PanoramaErrorEvent(path, err)); @@ -758,7 +758,7 @@ export class Viewer extends TypedEventTarget { /** * Changes the global mouse cursor */ - setCursor(cursor: string) { + setCursor(cursor: string | null) { this.state.cursorOverride = cursor; if (!cursor) { this.container.style.cursor = this.config.mousemove ? 'move' : 'default'; diff --git a/packages/core/src/components/Navbar.ts b/packages/core/src/components/Navbar.ts index c7b1622e..024a8f28 100644 --- a/packages/core/src/components/Navbar.ts +++ b/packages/core/src/components/Navbar.ts @@ -167,7 +167,7 @@ export class Navbar extends AbstractComponent { /** * Changes the navbar caption */ - setCaption(html: string) { + setCaption(html: string | null) { this.children.some((item) => { if (item instanceof NavbarCaption) { item.setCaption(html); diff --git a/packages/core/src/components/NavbarCaption.ts b/packages/core/src/components/NavbarCaption.ts index 1a11f7b0..f8e0a0d1 100644 --- a/packages/core/src/components/NavbarCaption.ts +++ b/packages/core/src/components/NavbarCaption.ts @@ -43,7 +43,7 @@ export class NavbarCaption extends AbstractButton { /** * Changes the caption */ - setCaption(html: string) { + setCaption(html: string | null) { this.show(); this.contentElt.innerHTML = html ?? ''; diff --git a/packages/core/src/services/Renderer.ts b/packages/core/src/services/Renderer.ts index 10b0fb25..e76ddcc9 100644 --- a/packages/core/src/services/Renderer.ts +++ b/packages/core/src/services/Renderer.ts @@ -195,7 +195,7 @@ export class Renderer extends AbstractService { /** * Resets or replaces the THREE renderer by a custom one */ - setCustomRenderer(factory: (renderer: WebGLRenderer) => CustomRenderer) { + setCustomRenderer(factory: ((renderer: WebGLRenderer) => CustomRenderer) | null) { if (factory) { this.customRenderer = factory(this.renderer); } else { diff --git a/packages/gallery-plugin/src/GalleryPlugin.ts b/packages/gallery-plugin/src/GalleryPlugin.ts index 1f6e5a49..1d345678 100644 --- a/packages/gallery-plugin/src/GalleryPlugin.ts +++ b/packages/gallery-plugin/src/GalleryPlugin.ts @@ -148,7 +148,7 @@ export class GalleryPlugin extends AbstractConfigurablePlugin< * @param [handler] function that will be called when an item is clicked instead of the default behavior * @throws {@link PSVError} if the configuration is invalid */ - setItems(items: GalleryItem[], handler?: (id: GalleryItem['id']) => void) { + setItems(items: GalleryItem[] | null, handler?: (id: GalleryItem['id']) => void) { if (!items) { items = []; } else { diff --git a/packages/map-plugin/src/MapPlugin.ts b/packages/map-plugin/src/MapPlugin.ts index 2c09517f..f95a4a6d 100644 --- a/packages/map-plugin/src/MapPlugin.ts +++ b/packages/map-plugin/src/MapPlugin.ts @@ -245,7 +245,7 @@ export class MapPlugin extends AbstractConfigurablePlugin< /** * Changes the hotspots on the map */ - setHotspots(hotspots: MapHotspot[], render = true) { + setHotspots(hotspots: MapHotspot[] | null, render = true) { const ids: string[] = []; let i = 1; @@ -276,7 +276,7 @@ export class MapPlugin extends AbstractConfigurablePlugin< /** * Changes the highlighted hotspot */ - setActiveHotspot(hotspotId: string) { + setActiveHotspot(hotspotId: string | null) { this.component.setActiveHotspot(hotspotId); } diff --git a/packages/markers-plugin/src/MarkersPlugin.ts b/packages/markers-plugin/src/MarkersPlugin.ts index aa767fd1..5d2e6248 100644 --- a/packages/markers-plugin/src/MarkersPlugin.ts +++ b/packages/markers-plugin/src/MarkersPlugin.ts @@ -459,7 +459,7 @@ export class MarkersPlugin extends AbstractConfigurablePlugin< /** * Replaces all markers */ - setMarkers(markers: MarkerConfig[], render = true) { + setMarkers(markers: MarkerConfig[] | null, render = true) { this.clearMarkers(false); markers?.forEach((marker) => { diff --git a/packages/plan-plugin/src/PlanPlugin.ts b/packages/plan-plugin/src/PlanPlugin.ts index 8b29535d..6834ca5f 100644 --- a/packages/plan-plugin/src/PlanPlugin.ts +++ b/packages/plan-plugin/src/PlanPlugin.ts @@ -221,7 +221,7 @@ export class PlanPlugin extends AbstractConfigurablePlugin< /** * Changes the hotspots on the map */ - setHotspots(hotspots: PlanHotspot[]) { + setHotspots(hotspots: PlanHotspot[] | null) { const ids: string[] = []; let i = 1; @@ -250,7 +250,7 @@ export class PlanPlugin extends AbstractConfigurablePlugin< /** * Changes the highlighted hotspot */ - setActiveHotspot(hotspotId: string) { + setActiveHotspot(hotspotId: string | null) { this.component.setActiveHotspot(hotspotId); } diff --git a/packages/resolution-plugin/src/ResolutionPlugin.ts b/packages/resolution-plugin/src/ResolutionPlugin.ts index de284650..3a03b886 100644 --- a/packages/resolution-plugin/src/ResolutionPlugin.ts +++ b/packages/resolution-plugin/src/ResolutionPlugin.ts @@ -103,7 +103,7 @@ export class ResolutionPlugin extends AbstractPlugin { * @throws {@link PSVError} if the configuration is invalid */ setResolutions(resolutions: Resolution[], defaultResolution?: string) { - this.resolutions = resolutions || []; + this.resolutions = resolutions; this.resolutionsById = {}; resolutions.forEach((resolution) => { diff --git a/packages/video-plugin/src/VideoPlugin.ts b/packages/video-plugin/src/VideoPlugin.ts index cd1d6a2b..21b182f2 100644 --- a/packages/video-plugin/src/VideoPlugin.ts +++ b/packages/video-plugin/src/VideoPlugin.ts @@ -294,7 +294,7 @@ export class VideoPlugin extends AbstractConfigurablePlugin< * Changes the keypoints * @throws {@link PSVError} if the configuration is invalid */ - setKeypoints(keypoints?: VideoKeypoint[]) { + setKeypoints(keypoints?: VideoKeypoint[] | null) { if (!this.autorotate) { throw new PSVError('Video keypoints required the AutorotatePlugin'); } diff --git a/packages/visible-range-plugin/src/VisibleRangePlugin.ts b/packages/visible-range-plugin/src/VisibleRangePlugin.ts index 929275a9..74e4fc86 100644 --- a/packages/visible-range-plugin/src/VisibleRangePlugin.ts +++ b/packages/visible-range-plugin/src/VisibleRangePlugin.ts @@ -127,7 +127,7 @@ export class VisibleRangePlugin extends AbstractConfigurablePlugin< /** * Changes the vertical range */ - setVerticalRange(range?: Range) { + setVerticalRange(range: Range | null) { // range must have two values if (range && range.length !== 2) { utils.logWarn('vertical range must have exactly two elements'); @@ -154,7 +154,7 @@ export class VisibleRangePlugin extends AbstractConfigurablePlugin< /** * Changes the horizontal range */ - setHorizontalRange(range?: Range) { + setHorizontalRange(range: Range | null) { // horizontal range must have two values if (range && range.length !== 2) { utils.logWarn('horizontal range must have exactly two elements');