From f20acc373e98909157da8890f069b0bcbbc51a63 Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Mon, 8 Jan 2024 21:45:52 -0500 Subject: [PATCH 01/11] fix: :bug: fix undefined error when attribution not available --- src/hud/index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hud/index.ts b/src/hud/index.ts index 16aaaae..237baaa 100644 --- a/src/hud/index.ts +++ b/src/hud/index.ts @@ -23,12 +23,15 @@ function showAttribution (visible: true) { if (attributionElem) { if (visible) { const satelliteStore = viewer.getSatelliteStore(); - if (satelliteStore && satelliteStore.getAttribution()) { - const attribution = satelliteStore.getAttribution() || {}; + if (satelliteStore?.getAttribution()) { + const attribution = satelliteStore.getAttribution(); const updatedDate = satelliteStore.getUpdatedDate(); + + if (attribution) { attributionElem.innerHTML = `Orbital object data from ${attribution.name} (updated ${updatedDate})`; + attributionElem.classList.remove('hidden'); + } } - attributionElem.classList.remove('hidden'); } else { attributionElem.classList.add('hidden'); } From dad6d3dac56d50d481128cd05e84ca69c76b9ca6 Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Mon, 8 Jan 2024 21:46:28 -0500 Subject: [PATCH 02/11] refactor: :rotating_light: use for of loop when possible --- src/hud/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hud/index.ts b/src/hud/index.ts index 237baaa..c39d9be 100644 --- a/src/hud/index.ts +++ b/src/hud/index.ts @@ -28,7 +28,7 @@ function showAttribution (visible: true) { const updatedDate = satelliteStore.getUpdatedDate(); if (attribution) { - attributionElem.innerHTML = `Orbital object data from ${attribution.name} (updated ${updatedDate})`; + attributionElem.innerHTML = `Orbital object data from ${attribution.name} (updated ${updatedDate})`; attributionElem.classList.remove('hidden'); } } @@ -277,12 +277,12 @@ function getSupportedEvents () { } function initMenus () { - const elements = document.querySelectorAll('.menu-item'); - for (let i = 0; i < elements.length; i++) { - const element = elements[i] as HTMLElement; + const elements = Array.from(document.querySelectorAll('.menu-item')); + + for (const element of elements) { element.addEventListener('click', () => { - const action = element.dataset.action; - if (action && action.startsWith('open:')) { + const action = (element as HTMLElement).dataset.action; + if (action?.startsWith('open:')) { const parts = action.split(':'); windowManager.openWindow(parts[1]); } From e24e865e9168c16d9a4742fcb6f22a46effac4f4 Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Mon, 8 Jan 2024 21:46:55 -0500 Subject: [PATCH 03/11] refactor: :rotating_light: use for of loop when possible --- src/utils/logger.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/logger.ts b/src/utils/logger.ts index 14ab4c9..7ada27f 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -41,8 +41,8 @@ function init () { const enabledOutputs = scope.enabledOutputs; - for (let i = 0; i < logLevels.length; i++) { - enabledOutputs[logLevels[i]] = true; + for (const logLevel of logLevels) { + enabledOutputs[logLevel] = true; } allOutputs = { From 1d12c6aaab0c1c45a9cbb65d9383eaf77904fd37 Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Mon, 8 Jan 2024 21:47:44 -0500 Subject: [PATCH 04/11] refactor: :recycle: avoid Record when possible --- src/utils/logger.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/logger.ts b/src/utils/logger.ts index 7ada27f..f38a015 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -3,7 +3,12 @@ const defaultLogLevel = 'debug'; const logLevels = ['error', 'warn', 'info', 'debug']; -let allOutputs: Record = {}; +let allOutputs = { + error: (..._args: any) => {}, + warn: (..._args: any) => {}, + info: (..._args: any) => {}, + debug: (..._args: any) => {} +}; let globalLogger = new Proxy({ logLevel: defaultLogLevel, enabledOutputs: {} as Record, From 9d1347d58b90551dd0ce0178cea0b19ec0a4e85d Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Mon, 8 Jan 2024 21:48:12 -0500 Subject: [PATCH 05/11] fix: :adhesive_bandage: async functions should have catch blocks --- src/viewer/Earth.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/viewer/Earth.ts b/src/viewer/Earth.ts index 851e9ac..b13feae 100644 --- a/src/viewer/Earth.ts +++ b/src/viewer/Earth.ts @@ -122,7 +122,9 @@ class Earth implements SceneComponent { this.group.add(this.sphere); if (this.addClouds) { - this.initClouds(scene, this.group); + this.initClouds(scene, this.group).catch(error => { + console.error('Error loading clouds', error); + }); } if (this.addAtmosphere) { From 6d5cff3621dd4e7362a1b5022484bbf792d8ca41 Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Mon, 8 Jan 2024 21:50:10 -0500 Subject: [PATCH 06/11] refactor: :recycle: use SatelliteObject interface when possible --- src/viewer/Satellites.ts | 3 ++- src/viewer/color-schemes/ColorScheme.ts | 7 ++++--- src/viewer/color-schemes/DefaultColorScheme.ts | 3 ++- src/viewer/color-schemes/GroupColorScheme.ts | 5 +++-- src/viewer/index.ts | 4 ++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/viewer/Satellites.ts b/src/viewer/Satellites.ts index c6336b2..622a6ff 100644 --- a/src/viewer/Satellites.ts +++ b/src/viewer/Satellites.ts @@ -21,6 +21,7 @@ import DefaultColorScheme from './color-schemes/DefaultColorScheme'; import SelectableSatellite from './interfaces/SelectableSatellite'; import ShaderStore from './ShaderStore'; import GroupColorScheme from './color-schemes/GroupColorScheme'; +import { SatelliteObject } from './interfaces/SatelliteObject'; class Satellites implements SceneComponent, SelectableSatellite { baseUrl = ''; @@ -94,7 +95,7 @@ class Satellites implements SceneComponent, SelectableSatellite { /** * update point colours */ - private updateSatellitesMaterial (satCount: number, satellites: Record[]) { + private updateSatellitesMaterial (satCount: number, satellites: SatelliteObject[]) { if (this.geometry?.attributes.color && this.currentColorScheme && this.satelliteStore) { // Adjust if the satellite count adjusts if (this.satelliteColors.length === 0 || (satCount * 4 !== this.satelliteColors.length)) { diff --git a/src/viewer/color-schemes/ColorScheme.ts b/src/viewer/color-schemes/ColorScheme.ts index 671be38..0ffcb7f 100644 --- a/src/viewer/color-schemes/ColorScheme.ts +++ b/src/viewer/color-schemes/ColorScheme.ts @@ -1,15 +1,16 @@ import SatelliteGroup from '../SatelliteGroup'; +import { SatelliteObject } from '../interfaces/SatelliteObject'; class ColorScheme { name: string; - colorizer: (satellite: Record, group?: SatelliteGroup) => { color: number[], pickable: boolean }; + colorizer: (satellite: SatelliteObject, group?: SatelliteGroup) => { color: number[], pickable: boolean }; - constructor (name: string, colorizer: (satellite: Record) => { color: number[], pickable: boolean }) { + constructor (name: string, colorizer: (satellite: SatelliteObject) => { color: number[], pickable: boolean }) { this.name = name; this.colorizer = colorizer; } - getSatelliteColor (satellite: Record, group?: SatelliteGroup): { color: number[], pickable: boolean } { + getSatelliteColor (satellite: SatelliteObject, group?: SatelliteGroup): { color: number[], pickable: boolean } { return this.colorizer(satellite, group); } } diff --git a/src/viewer/color-schemes/DefaultColorScheme.ts b/src/viewer/color-schemes/DefaultColorScheme.ts index 64c0e3d..97289cc 100644 --- a/src/viewer/color-schemes/DefaultColorScheme.ts +++ b/src/viewer/color-schemes/DefaultColorScheme.ts @@ -1,8 +1,9 @@ +import { SatelliteObject } from '../interfaces/SatelliteObject'; import ColorScheme from './ColorScheme'; class DefaultColorScheme extends ColorScheme { constructor () { - super ('Default color scheme', (satellite: Record) => { + super ('Default color scheme', (satellite: SatelliteObject) => { let color = [1.0, 1.0, 0.0, 1.0]; let pickable = false; diff --git a/src/viewer/color-schemes/GroupColorScheme.ts b/src/viewer/color-schemes/GroupColorScheme.ts index 3a46d5b..45585e7 100644 --- a/src/viewer/color-schemes/GroupColorScheme.ts +++ b/src/viewer/color-schemes/GroupColorScheme.ts @@ -1,11 +1,12 @@ import SatelliteGroup from '@satellite-viewer/SatelliteGroup'; import ColorScheme from './ColorScheme'; +import { SatelliteObject } from '../interfaces/SatelliteObject'; class GroupColorScheme extends ColorScheme { constructor () { - super ('Group color scheme', (satellite: Record, group?: SatelliteGroup) => { + super ('Group color scheme', (satellite: SatelliteObject, group?: SatelliteGroup) => { if (satellite) { - if (group && group.hasSat(satellite.id)) { + if (group?.hasSat(satellite.id)) { return { color: [1.0, 0.2, 0.0, 1.0], pickable: true diff --git a/src/viewer/index.ts b/src/viewer/index.ts index 71106e2..37fcd7c 100644 --- a/src/viewer/index.ts +++ b/src/viewer/index.ts @@ -82,7 +82,7 @@ class Viewer { } } - private onSatDataLoaded (satData: Record) { + private onSatDataLoaded (satData: SatelliteObject[]) { this.eventManager.fireEvent('satdataloaded', satData); this.ready = true; } @@ -404,7 +404,7 @@ class Viewer { this.satellites?.setSatelliteGroup(satelliteGroup); } - getSelectedSatellite (): Record | undefined { + getSelectedSatellite (): SatelliteObject | undefined { if (this.satelliteStore) { return this.satelliteStore.getSatellite(this.selectedSatelliteIdx); } From de3a0c719f7536029ea6757837e6fdc44a25005e Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Mon, 8 Jan 2024 21:51:33 -0500 Subject: [PATCH 07/11] refactor: :recycle: use ViewerContext in lieu of Record --- src/viewer/Earth.ts | 3 ++- src/viewer/Orbits.ts | 5 +++-- src/viewer/Satellites.ts | 3 ++- src/viewer/Universe.ts | 3 ++- src/viewer/index.ts | 15 ++++++++++++++- src/viewer/interfaces/SceneComponent.ts | 3 ++- 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/viewer/Earth.ts b/src/viewer/Earth.ts index b13feae..2b60821 100644 --- a/src/viewer/Earth.ts +++ b/src/viewer/Earth.ts @@ -2,6 +2,7 @@ import { ShaderMaterial, UniformsUtils, Texture } from 'three'; import { Color, TextureLoader, MeshPhongMaterial, SphereGeometry, Mesh, Group, BackSide, AdditiveBlending } from '../utils/three'; import SceneComponent from './interfaces/SceneComponent'; import SatelliteOrbitScene from './SatelliteOrbitScene'; +import { ViewerContext } from '.'; class Earth implements SceneComponent { baseUrl = ''; @@ -91,7 +92,7 @@ class Earth implements SceneComponent { group.add(mesh); } - async init (scene: SatelliteOrbitScene, context: Record) { + async init (scene: SatelliteOrbitScene, context: ViewerContext) { if (context.config) { this.baseUrl = context.config.baseUrl; } diff --git a/src/viewer/Orbits.ts b/src/viewer/Orbits.ts index fa1dd31..7a3f4fd 100644 --- a/src/viewer/Orbits.ts +++ b/src/viewer/Orbits.ts @@ -7,6 +7,7 @@ import SatelliteOrbitScene from './SatelliteOrbitScene'; import logger from '../utils/logger'; import SatelliteGroups from './SatelliteGroups'; import SelectableSatellite from './interfaces/SelectableSatellite'; +import { ViewerContext } from '.'; class Orbits implements SceneComponent, SelectableSatellite { config: Record = {}; @@ -221,12 +222,12 @@ class Orbits implements SceneComponent, SelectableSatellite { // calculate tracks if (this.satelliteGroup) { const satellites = this.satelliteGroup.sats; - const satelliteIds = satellites.map((entry: Record) => entry.satId as number); + const satelliteIds = satellites.map((entry) => entry.satId as number); this.calculateOrbits(satelliteIds); } } - init (scene: SatelliteOrbitScene, context: Record) { + init (scene: SatelliteOrbitScene, context: ViewerContext) { this.config = context.config; this.scene = scene; this.orbitWorker = new OrbitCalculationWorker(); diff --git a/src/viewer/Satellites.ts b/src/viewer/Satellites.ts index 622a6ff..7b44212 100644 --- a/src/viewer/Satellites.ts +++ b/src/viewer/Satellites.ts @@ -22,6 +22,7 @@ import SelectableSatellite from './interfaces/SelectableSatellite'; import ShaderStore from './ShaderStore'; import GroupColorScheme from './color-schemes/GroupColorScheme'; import { SatelliteObject } from './interfaces/SatelliteObject'; +import { ViewerContext } from '.'; class Satellites implements SceneComponent, SelectableSatellite { baseUrl = ''; @@ -333,7 +334,7 @@ class Satellites implements SceneComponent, SelectableSatellite { })); } - async init (scene: SatelliteOrbitScene, context: Record) { + async init (scene: SatelliteOrbitScene, context: ViewerContext) { this.satelliteStore = context.satelliteStore; this.shaderStore = context.shaderStore; this.scene = scene; diff --git a/src/viewer/Universe.ts b/src/viewer/Universe.ts index 1cfe126..2679791 100644 --- a/src/viewer/Universe.ts +++ b/src/viewer/Universe.ts @@ -1,9 +1,10 @@ +import { ViewerContext } from '.'; import { TextureLoader } from '../utils/three'; import SceneComponent from './interfaces/SceneComponent'; import SatelliteOrbitScene from './SatelliteOrbitScene'; class Universe implements SceneComponent { - init (scene: SatelliteOrbitScene, context: Record) { + init (scene: SatelliteOrbitScene, context: ViewerContext) { const baseUrl = context.config.baseUrl; const texture = new TextureLoader().load(`${baseUrl}textures/example_render.jpg`); diff --git a/src/viewer/index.ts b/src/viewer/index.ts index 37fcd7c..86ff2f3 100644 --- a/src/viewer/index.ts +++ b/src/viewer/index.ts @@ -16,6 +16,14 @@ import SatelliteGroup from './SatelliteGroup'; import ShaderStore from './ShaderStore'; import logger from '@/utils/logger'; import { ArrowHelper, Raycaster, Vector2, Vector3 } from 'three'; +import { SatelliteObject } from './interfaces/SatelliteObject'; + +export interface ViewerContext { + satelliteGroups: SatelliteGroups; + config: Record; + satelliteStore: SatelliteStore; + shaderStore: ShaderStore; +} class Viewer { config: Record = { @@ -28,7 +36,12 @@ class Viewer { camera?: PerspectiveCamera; controls?: OrbitControls; renderer?: WebGLRenderer; - context: Record = {}; + context: ViewerContext = { + satelliteGroups: null as unknown as SatelliteGroups, + config: null as unknown as Record, + satelliteStore: null as unknown as SatelliteStore, + shaderStore: null as unknown as ShaderStore + }; satelliteGroups?: SatelliteGroups; satelliteStore?: SatelliteStore; shaderStore?: ShaderStore; diff --git a/src/viewer/interfaces/SceneComponent.ts b/src/viewer/interfaces/SceneComponent.ts index 399ae68..6b768ff 100644 --- a/src/viewer/interfaces/SceneComponent.ts +++ b/src/viewer/interfaces/SceneComponent.ts @@ -1,7 +1,8 @@ +import { ViewerContext } from '..'; import SatelliteOrbitScene from '../SatelliteOrbitScene'; interface SceneComponent { - init (scene: SatelliteOrbitScene, context: Record): void | Promise; + init (scene: SatelliteOrbitScene, context: ViewerContext): void | Promise; update (scene?: SatelliteOrbitScene): void; } From 126c9b16a7e744e0f0ddd1c00d89dc403bf9527d Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Mon, 8 Jan 2024 21:52:24 -0500 Subject: [PATCH 08/11] refactor: :recycle: use SatelliteGroup interface --- src/viewer/SatelliteGroups.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/viewer/SatelliteGroups.ts b/src/viewer/SatelliteGroups.ts index b8b9656..81e3a9e 100644 --- a/src/viewer/SatelliteGroups.ts +++ b/src/viewer/SatelliteGroups.ts @@ -1,6 +1,7 @@ import SatGroup from './SatelliteGroup'; import logger from '../utils/logger'; import SatelliteStore from './SatelliteStore'; +import type SatelliteGroup from './SatelliteGroup'; class SatelliteGroups { groups: Record = {}; @@ -8,7 +9,7 @@ class SatelliteGroups { sats: any[] = []; satelliteStore: SatelliteStore; - constructor (satelliteGroups: Record[], satelliteStore: SatelliteStore) { + constructor (satelliteGroups: SatelliteGroup[], satelliteStore: SatelliteStore) { if (!satelliteStore) { throw new Error('satelliteStore is required'); } @@ -59,7 +60,7 @@ class SatelliteGroups { } } - resetConfig (satelliteGroups: Record[]) { + resetConfig (satelliteGroups: SatelliteGroup[]) { const groupConfigs = satelliteGroups; for (let i = 0; i < groupConfigs.length; i++) { logger.debug(`registering satellite group ${groupConfigs[i].name} (id: ${groupConfigs[i].id})`); From bcc93bce9260865b4263a14a3819946b09dc43dd Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Mon, 8 Jan 2024 21:52:45 -0500 Subject: [PATCH 09/11] refactor: :rotating_light: use for of loop when possible --- src/viewer/SatelliteGroups.ts | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/viewer/SatelliteGroups.ts b/src/viewer/SatelliteGroups.ts index 81e3a9e..2a0c86c 100644 --- a/src/viewer/SatelliteGroups.ts +++ b/src/viewer/SatelliteGroups.ts @@ -27,13 +27,12 @@ class SatelliteGroups { this.selectedGroup = group; if (!group) { this.clearSelect(); - return; } } forEach (callback: (satId: number) => void) { - for (let i = 0; i < this.sats.length; i++) { - callback(this.sats[i].satId); + for (const sat of this.sats) { + callback(sat.satId); } } @@ -55,21 +54,21 @@ class SatelliteGroups { reloadGroups () { const keys = Object.keys(this.groups); - for (let i = 0; i < keys.length; i++) { - this.groups[keys[i]].reload(); + for (const key of keys) { + this.groups[key].reload(); } } resetConfig (satelliteGroups: SatelliteGroup[]) { const groupConfigs = satelliteGroups; - for (let i = 0; i < groupConfigs.length; i++) { - logger.debug(`registering satellite group ${groupConfigs[i].name} (id: ${groupConfigs[i].id})`); - this.groups[groupConfigs[i].id.toLowerCase()] = new SatGroup( - groupConfigs[i].id.toLowerCase(), - groupConfigs[i].name, - groupConfigs[i].groupType, - groupConfigs[i].data, - this.satelliteStore as SatelliteStore + for (const groupConfig of groupConfigs) { + logger.debug(`registering satellite group ${groupConfig.name} (id: ${groupConfig.id})`); + this.groups[groupConfig.id.toLowerCase()] = new SatGroup( + groupConfig.id.toLowerCase(), + groupConfig.name, + groupConfig.groupType, + groupConfig.data, + this.satelliteStore ); } } From c2b72242e3b8c484c26f6df9ac6e36315e76bdcd Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Mon, 8 Jan 2024 21:53:03 -0500 Subject: [PATCH 10/11] refactor: :recycle: use defined interface when possible --- src/viewer/SatelliteStore.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/viewer/SatelliteStore.ts b/src/viewer/SatelliteStore.ts index 33663fc..ac623b9 100644 --- a/src/viewer/SatelliteStore.ts +++ b/src/viewer/SatelliteStore.ts @@ -11,7 +11,10 @@ class SatelliteStore { tleUrl = `${config.baseUrl}/data/attributed-TLE.json`; eventManager: EventManager; satData: SatelliteObject[] = []; - attribution?: Record; + attribution?: { + name: string; + url: string; + }; updateDate?: Date; satelliteVelocities: Float32Array = new Float32Array(); satellitePositions: Float32Array = new Float32Array(); @@ -65,7 +68,10 @@ class SatelliteStore { } } - getAttribution (): Record | undefined { + getAttribution (): { + name: string; + url: string; + } | undefined { return this.attribution; } From 065116baa50b4fd108fbe9fec09f19112b7ebec8 Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Mon, 8 Jan 2024 21:55:08 -0500 Subject: [PATCH 11/11] refactor: :truck: move interface to interface folder --- src/viewer/Earth.ts | 2 +- src/viewer/Orbits.ts | 2 +- src/viewer/Satellites.ts | 2 +- src/viewer/Universe.ts | 2 +- src/viewer/index.ts | 8 +------- src/viewer/interfaces/SceneComponent.ts | 2 +- src/viewer/interfaces/ViewerContext.ts | 11 +++++++++++ 7 files changed, 17 insertions(+), 12 deletions(-) create mode 100644 src/viewer/interfaces/ViewerContext.ts diff --git a/src/viewer/Earth.ts b/src/viewer/Earth.ts index 2b60821..0ba6c3f 100644 --- a/src/viewer/Earth.ts +++ b/src/viewer/Earth.ts @@ -2,7 +2,7 @@ import { ShaderMaterial, UniformsUtils, Texture } from 'three'; import { Color, TextureLoader, MeshPhongMaterial, SphereGeometry, Mesh, Group, BackSide, AdditiveBlending } from '../utils/three'; import SceneComponent from './interfaces/SceneComponent'; import SatelliteOrbitScene from './SatelliteOrbitScene'; -import { ViewerContext } from '.'; +import { ViewerContext } from './interfaces/ViewerContext'; class Earth implements SceneComponent { baseUrl = ''; diff --git a/src/viewer/Orbits.ts b/src/viewer/Orbits.ts index 7a3f4fd..10812be 100644 --- a/src/viewer/Orbits.ts +++ b/src/viewer/Orbits.ts @@ -7,7 +7,7 @@ import SatelliteOrbitScene from './SatelliteOrbitScene'; import logger from '../utils/logger'; import SatelliteGroups from './SatelliteGroups'; import SelectableSatellite from './interfaces/SelectableSatellite'; -import { ViewerContext } from '.'; +import { ViewerContext } from './interfaces/ViewerContext'; class Orbits implements SceneComponent, SelectableSatellite { config: Record = {}; diff --git a/src/viewer/Satellites.ts b/src/viewer/Satellites.ts index 7b44212..8366687 100644 --- a/src/viewer/Satellites.ts +++ b/src/viewer/Satellites.ts @@ -22,7 +22,7 @@ import SelectableSatellite from './interfaces/SelectableSatellite'; import ShaderStore from './ShaderStore'; import GroupColorScheme from './color-schemes/GroupColorScheme'; import { SatelliteObject } from './interfaces/SatelliteObject'; -import { ViewerContext } from '.'; +import { ViewerContext } from './interfaces/ViewerContext'; class Satellites implements SceneComponent, SelectableSatellite { baseUrl = ''; diff --git a/src/viewer/Universe.ts b/src/viewer/Universe.ts index 2679791..4c79d33 100644 --- a/src/viewer/Universe.ts +++ b/src/viewer/Universe.ts @@ -1,4 +1,4 @@ -import { ViewerContext } from '.'; +import { ViewerContext } from './interfaces/ViewerContext'; import { TextureLoader } from '../utils/three'; import SceneComponent from './interfaces/SceneComponent'; import SatelliteOrbitScene from './SatelliteOrbitScene'; diff --git a/src/viewer/index.ts b/src/viewer/index.ts index 86ff2f3..577a820 100644 --- a/src/viewer/index.ts +++ b/src/viewer/index.ts @@ -17,13 +17,7 @@ import ShaderStore from './ShaderStore'; import logger from '@/utils/logger'; import { ArrowHelper, Raycaster, Vector2, Vector3 } from 'three'; import { SatelliteObject } from './interfaces/SatelliteObject'; - -export interface ViewerContext { - satelliteGroups: SatelliteGroups; - config: Record; - satelliteStore: SatelliteStore; - shaderStore: ShaderStore; -} +import { ViewerContext } from './interfaces/ViewerContext'; class Viewer { config: Record = { diff --git a/src/viewer/interfaces/SceneComponent.ts b/src/viewer/interfaces/SceneComponent.ts index 6b768ff..465b1bc 100644 --- a/src/viewer/interfaces/SceneComponent.ts +++ b/src/viewer/interfaces/SceneComponent.ts @@ -1,4 +1,4 @@ -import { ViewerContext } from '..'; +import { ViewerContext } from './ViewerContext'; import SatelliteOrbitScene from '../SatelliteOrbitScene'; interface SceneComponent { diff --git a/src/viewer/interfaces/ViewerContext.ts b/src/viewer/interfaces/ViewerContext.ts new file mode 100644 index 0000000..ea3c3d1 --- /dev/null +++ b/src/viewer/interfaces/ViewerContext.ts @@ -0,0 +1,11 @@ +import type SatelliteGroups from '../SatelliteGroups'; +import type SatelliteStore from '../SatelliteStore'; +import type ShaderStore from '../ShaderStore'; + + +export interface ViewerContext { + satelliteGroups: SatelliteGroups; + config: Record; + satelliteStore: SatelliteStore; + shaderStore: ShaderStore; +}