Skip to content

Commit

Permalink
[desktop]: Fix load image FOVs
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagohm committed Feb 29, 2024
1 parent 2de3db1 commit 8753e07
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
9 changes: 3 additions & 6 deletions desktop/src/app/image/image.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { PreferenceService } from '../../shared/services/preference.service'
import { PrimeService } from '../../shared/services/prime.service'
import { CheckableMenuItem, ToggleableMenuItem } from '../../shared/types/app.types'
import { Angle, AstronomicalObject, DeepSkyObject, EquatorialCoordinateJ2000, Star } from '../../shared/types/atlas.types'
import { Camera } from '../../shared/types/camera.types'
import { DEFAULT_FOV, DetectedStar, EMPTY_IMAGE_SOLVED, FITSHeaderItem, FOV, ImageAnnotation, ImageChannel, ImageData, ImageInfo, ImagePreference, ImageSolved, ImageStatisticsBitOption, SCNRProtectionMethod, SCNR_PROTECTION_METHODS } from '../../shared/types/image.types'
import { Mount } from '../../shared/types/mount.types'
import { DEFAULT_SOLVER_TYPES } from '../../shared/types/settings.types'
Expand Down Expand Up @@ -546,8 +545,6 @@ export class ImageComponent implements AfterViewInit, OnDestroy {
await this.loadImageFromPath(this.imageData.path)
}

this.loadPreference(this.imageData.camera)

if (this.imageData.title) {
this.app.subTitle = this.imageData.title
} else if (this.imageData.camera) {
Expand Down Expand Up @@ -871,8 +868,8 @@ export class ImageComponent implements AfterViewInit, OnDestroy {
}
}

private loadPreference(camera?: Camera) {
const preference = this.preference.imagePreference(camera).get()
private loadPreference() {
const preference = this.preference.imagePreference.get()
this.solverRadius = preference.solverRadius ?? this.solverRadius
this.solverType = preference.solverType ?? this.solverTypes[0]
this.fovs = this.preference.imageFOVs.get()
Expand All @@ -885,7 +882,7 @@ export class ImageComponent implements AfterViewInit, OnDestroy {
solverType: this.solverType
}

this.preference.imagePreference(this.imageData.camera).set(preference)
this.preference.imagePreference.set(preference)
}

private async executeMount(action: (mount: Mount) => void) {
Expand Down
6 changes: 1 addition & 5 deletions desktop/src/shared/services/preference.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ export class PreferenceService {
return new PreferenceData<PlateSolverOptions>(this.storage, `settings.plateSolver.${type}`, () => <PlateSolverOptions>{ ...EMPTY_PLATE_SOLVER_OPTIONS, type })
}

imagePreference(camera?: Camera) {
const key = camera ? `image.${camera.name}` : 'image'
return new PreferenceData<ImagePreference>(this.storage, key, () => EMPTY_IMAGE_PREFERENCE)
}

readonly imagePreference = new PreferenceData<ImagePreference>(this.storage, 'image', () => structuredClone(EMPTY_IMAGE_PREFERENCE))
readonly alignmentPreference = new PreferenceData<AlignmentPreference>(this.storage, `alignment`, () => structuredClone(EMPTY_ALIGNMENT_PREFERENCE))
readonly connections = new PreferenceData<ConnectionDetails[]>(this.storage, 'home.connections', () => [])
readonly homeImageDefaultDirectory = new PreferenceData<string>(this.storage, 'home.image.directory', '')
Expand Down

0 comments on commit 8753e07

Please sign in to comment.