Skip to content

Commit

Permalink
Merge branch 'main' into usnob-toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
Carifio24 authored Aug 21, 2024
2 parents 2889d4b + b495f2c commit 3e240c3
Showing 1 changed file with 21 additions and 31 deletions.
52 changes: 21 additions & 31 deletions src/BlazeStarNova.vue
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
<div style="flex-grow:1;"></div>

<icon-button
v-if="!isTourPlaying"
:fa-icon="timePlaying ? 'pause' : 'play'"
:color="buttonColor"
tooltip-text="Let time move forward"
Expand Down Expand Up @@ -279,7 +280,7 @@ import { useDisplay} from 'vuetify';
import { throttle } from './debounce';
import { equatorialToHorizontal } from "./utils";
import { EquatorialRad, LocationRad } from "./types";
import { LocationRad } from "./types";
import { resetAltAzGridText, makeAltAzGridText, setupConstellationFigures, renderOneFrame } from "./wwt-hacks";
import { usePlaybackControl } from "./wwt_playback_control";
Expand Down Expand Up @@ -362,6 +363,7 @@ const clockRate = 1000;
const crbPlace = new Place();
crbPlace.set_RA(15 + 59 / 60 + 30.1622 / 3600);
crbPlace.set_dec(25 + 55 / 60 + 12.613 / 3600);
crbPlace.set_zoomLevel(180);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Expand All @@ -373,35 +375,23 @@ function getWWTLocation(): LocationRad {
};
}
const blazeStarLocation: EquatorialRad = {
raRad: (15 + 59 / 60 + 30.1622 / 3600) * 15 * D2R,
decRad: (25 + 55 / 60 + 12.613 / 3600) * D2R,
};
async function goToTCrB(instant=false): Promise<void> {
return store.gotoRADecZoom({
raRad: blazeStarLocation.raRad,
decRad: blazeStarLocation.decRad,
zoomDeg: 180,
instant: instant,
return store.gotoTarget({
place: crbPlace,
noZoom: false,
instant,
trackObject: false,
});
}
// function isTCrBOnScreen(): boolean {
// const screenPoint = store.findScreenPointForRADec({ ra: crbPlace.get_RA() * 15, dec: crbPlace.get_dec() });
// console.log(screenPoint);
// return screenPoint.x >= 0 && screenPoint.x <= window.innerWidth &&
// screenPoint.y >= 0 && screenPoint.y <= window.innerHeight;
// }
function toggleAndGoToNova() {
// const instant = isTCrBOnScreen();
// console.log("Instant", instant);
goToTCrB().then(() => {
store.setBackgroundImageByName(store.backgroundImageset?.get_name() == TYCHO_ISET_NAME ? USNOB_ISET_NAME : TYCHO_ISET_NAME);
});
}
// create selectedDate by default is today at 9pm localtime
function todayAt9pm() {
// get's today's date and
Expand Down Expand Up @@ -608,7 +598,7 @@ function clearCurrentTour() {
function playPauseTour() {
if (!isTourPlaying.value) {
beforeTourTime = store.currentTime;
beforeTourTime = selectedDate.value;
store.loadTour({ url: `${window.location.origin}/FindingCoronaBorealis.WTT`, play: true });
} else {
clearCurrentTour();
Expand All @@ -618,19 +608,20 @@ function playPauseTour() {
function onTourPlayingChange(playing: boolean) {
WWTControl.singleton.renderOneFrame = playing ? originalFrameRender : newFrameRender;
if (!playing) {
if (playing) {
playbackControl.pause();
} else {
clearCurrentTour();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
WWTControl.singleton.set__mover(null);
store.applySetting(["localHorizonMode", true]);
store.gotoRADecZoom({
raRad: store.raRad,
decRad: store.decRad,
zoomDeg: store.zoomDeg,
rollRad: 0,
instant: true,
});
store.setTime(beforeTourTime);
store.setBackgroundImageByName(TYCHO_ISET_NAME);
WWTControl.singleton.renderOneFrame();
selectedDate.value = beforeTourTime;
// The watcher will do this, but we need it to happen now,
// before we move
store.setTime(beforeTourTime);
goToTCrB(true);
}
}
Expand Down Expand Up @@ -678,7 +669,6 @@ watch(showConstellations, (show) => {
store.applySetting(["showConstellationFigures", show]);
});
watch(selectedDate, (date) => {
// if we are playing this already getting updated
store.setTime(date);
Expand Down

0 comments on commit 3e240c3

Please sign in to comment.