Skip to content
Merged

Work #107

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6b81152
x
pholmq Dec 19, 2025
da07403
Plancam height adjustable to negative values
pholmq Jan 14, 2026
e0f23be
x
pholmq Jan 14, 2026
ce78785
cities update
pholmq Jan 16, 2026
69bf669
Ephimerides work
pholmq Jan 16, 2026
6508e95
Ephimerides to Ephemerides
pholmq Jan 20, 2026
0b7bd51
eph work
pholmq Jan 20, 2026
75fc8cf
Eph work
pholmq Jan 20, 2026
842e83b
eph work
pholmq Jan 20, 2026
38d8c54
eph work
pholmq Jan 20, 2026
adcd197
eph refactor. move model isnt
pholmq Jan 20, 2026
fa0edbb
EphController refactored so it uses useFrame
pholmq Jan 22, 2026
1af049a
eph work
pholmq Jan 22, 2026
1724624
refatored moveModel to movePlotModel
pholmq Jan 22, 2026
a2f86a1
eph work
pholmq Jan 22, 2026
540f0d4
eph work
pholmq Jan 23, 2026
832213e
eph work
pholmq Jan 23, 2026
d0c8a52
eph work working!
pholmq Jan 23, 2026
ff28ff4
eph work
pholmq Jan 23, 2026
004c660
ephemerides file save
pholmq Jan 23, 2026
7d4257f
eph work
pholmq Jan 23, 2026
7997c9f
Star labels bugfix
pholmq Jan 23, 2026
380c196
Smaller hover panels
pholmq Jan 23, 2026
25effaa
HA Rey constellations
pholmq Jan 26, 2026
5812e1a
Constellations
pholmq Jan 26, 2026
55ca4e1
constellation stars fix
pholmq Jan 26, 2026
60c3544
constellations on/off work
pholmq Jan 26, 2026
f083049
constellations on off
pholmq Jan 27, 2026
f8a189d
constellation sphere working!
pholmq Jan 27, 2026
75b7c3a
blue lines
pholmq Jan 27, 2026
e96a945
changed ground planet transition
pholmq Jan 27, 2026
0c25699
version bump for electron build
pholmq Jan 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions HowToMakeAElectronRelease.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ Increase the version number in package.json

"version": "1.0.1" <-- Increase

On GitHub Create a pull request with base: electron and compare: main
On GitHub Create a pull request with base: electron and compare: work

When the pull request is merged, the build will start in GitHub actions
and take about 10 minutes to complete. When finished there will be an
and take about 15 minutes to complete. When finished there will be an
unpublished release at https://github.com/pholmq/TSN/releases that can
be edited and published
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "git",
"url": "git+https://github.com/pholmq/TSN.git"
},
"version": "1.0.2",
"version": "1.0.3",
"author": "Patrik Holmqvist",
"description": "The Tychosium www.tychos.space",
"license": "GPL-2.0-or-only",
Expand Down
6 changes: 6 additions & 0 deletions src/TSNext.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import PlanetsPositionsMenu from "./components/Menus/PlanetsPositionsMenu";
import StarsHelpersMenu from "./components/Menus/StarsHelpersMenu";
import PosController from "./components/PosController";
import Positions from "./components/Menus/Positions";
import Ephemerides from "./components/Menus/Ephemerides";
import EphController from "./components/EphController";
import Stars from "./components/Stars/Stars";
import LabeledStars from "./components/Stars/LabeledStars";
// import BSCStars from "./components/Stars/BSCStars";
Expand All @@ -30,6 +32,7 @@ import HighlightSelectedStar from "./components/StarSearch/HighlightSelectedStar
import Help from "./components/Help/Help";
import PlanetCameraCompass from "./components/PlanetCamera/PlanetCameraCompass";
import TransitionCamera from "./components/PlanetCamera/TransitionCamera";
import Constellations from"./components/Stars/Constellations";

const isTouchDevice = () => {
return (
Expand Down Expand Up @@ -99,6 +102,7 @@ const TSNext = () => {
<div>
<UserInterface />
<Positions />
<Ephemerides />
<EditSettings />
<PlanetCameraUI />
<StarDataPanel />
Expand Down Expand Up @@ -127,6 +131,7 @@ const TSNext = () => {
<AnimationController />
<PosController />
<TraceController />
<EphController />
<PlanetsPositionsMenu />
<StarsHelpersMenu />
<LightEffectsMenu />
Expand All @@ -137,6 +142,7 @@ const TSNext = () => {
{BSCStarsOn && <BSCStarsH />}
{BSCStarsOn && !isTouchDev && <HighlightSelectedStar />}
<Zodiac />
<Constellations />
</Suspense>
</Canvas>
</>
Expand Down
134 changes: 134 additions & 0 deletions src/components/EphController.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import { useEffect, useState } from "react";
import { useThree } from "@react-three/fiber";
import { useStore, usePlotStore, useSettingsStore } from "../store";
import { useEphemeridesStore } from "./Menus/ephemeridesStore";
import useFrameInterval from "../utils/useFrameInterval";
import {
posToDate,
posToTime,
dateTimeToPos,
sDay,
} from "../utils/time-date-functions";
import {
movePlotModel,
getPlotModelRaDecDistance,
} from "../utils/plotModelFunctions";

// --- Helper function to save file ---
const saveEphemeridesAsText = (data, params) => {
let output = "--- EPHEMERIDES REPORT ---\n";
output += `Generated on: ${new Date().toLocaleString()}\n`;
output += `Start Date: ${params.startDate}\n`;
output += `End Date: ${params.endDate}\n`;
output += `Step Size: ${params.stepSize} ${params.stepFactor === 1 ? "Days" : "Years"}\n`;
output += "--------------------------------------\n\n";

Object.keys(data).forEach((planetName) => {
output += `PLANET: ${planetName.toUpperCase()}\n`;
// Table Header
output += `${"Date".padEnd(12)} | ${"Time".padEnd(10)} | ${"RA".padEnd(12)} | ${"Dec".padEnd(12)} | ${"Dist".padEnd(12)} | ${"Elongation".padEnd(10)}\n`;
output += "-".repeat(80) + "\n";

// Table Rows
data[planetName].forEach((row) => {
output += `${row.date.padEnd(12)} | ${row.time.padEnd(10)} | ${row.ra.padEnd(12)} | ${row.dec.padEnd(12)} | ${row.dist.padEnd(12)} | ${row.elong}\n`;
});
output += "\n" + "=".repeat(80) + "\n\n";
});

// Create Blob
const blob = new Blob([output], { type: "text/plain" });
const url = URL.createObjectURL(blob);

// Generate Filename from Start and End Dates
// We replace potential unsafe characters just in case, though standard YYYY-MM-DD is usually safe
const safeStart = params.startDate.replace(/[:/]/g, "-");
const safeEnd = params.endDate.replace(/[:/]/g, "-");
const filename = `Ephemerides_${safeStart}_to_${safeEnd}.txt`;

// Trigger Download
const link = document.createElement("a");
link.href = url;
link.download = filename;
document.body.appendChild(link);
link.click();

// Cleanup
document.body.removeChild(link);
URL.revokeObjectURL(url);
};

const EphController = () => {
const { scene } = useThree();
const plotObjects = usePlotStore((s) => s.plotObjects);

const { trigger, params, resetTrigger } = useEphemeridesStore();

const [done, setDone] = useState(true);

useEffect(() => {
if (trigger && params) {
const startPos = dateTimeToPos(params.startDate, "12:00:00");
const endPos = dateTimeToPos(params.endDate, "12:00:00");
if (params.checkedPlanets.length > 0 && startPos <= endPos) {
setDone(false);
}
resetTrigger();
}
}, [trigger, params, resetTrigger]);

useFrameInterval(() => {
if (done) return;

const { startDate, endDate, stepSize, stepFactor, checkedPlanets } = params;

const startPos = dateTimeToPos(startDate, "12:00:00");
const endPos = dateTimeToPos(endDate, "12:00:00");
const increment = stepSize * stepFactor;

const ephemeridesData = {};
checkedPlanets.forEach((planet) => {
ephemeridesData[planet] = [];
});

let currentPos = startPos;
let steps = 0;
const MAX_STEPS = 50000;

// console.log("--- Starting Ephemerides Generation ---");

while (currentPos <= endPos && steps < MAX_STEPS) {
const currentDate = posToDate(currentPos);
const currentTime = posToTime(currentPos);

movePlotModel(plotObjects, currentPos);

checkedPlanets.forEach((name) => {
const data = getPlotModelRaDecDistance(name, plotObjects, scene);

if (data) {
ephemeridesData[name].push({
date: currentDate,
time: currentTime,
ra: data.ra,
dec: data.dec,
dist: data.dist,
elong: data.elongation,
});
}
});

currentPos += increment;
steps++;
}
setDone(true);

// console.log(`Generation Complete. Steps: ${steps}`);

// Trigger the save file dialog with the new naming convention
saveEphemeridesAsText(ephemeridesData, params);
});

return null;
};
export default EphController;
5 changes: 4 additions & 1 deletion src/components/HoverObj/HoverPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ const HoverPanel = ({ hovered, contextMenu, setContextMenu, s }) => {
>
<div
className="info-panel"
style={{ transform: "translateX(-60%)" }}
style={{
transform: "translateX(-60%) scale(0.8)",
transformOrigin: "top left"
}}
onContextMenu={(e) => {
if (pinned) {
e.preventDefault();
Expand Down
17 changes: 14 additions & 3 deletions src/components/LevaUI.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,17 @@ const LevaUI = () => {
geoSphere,
setGeoSphere,
ephimerides,
setEphimerides,
setEphemerides,
BSCStars,
setBSCStars,
hScale,
sethScale,
searchStars,
setSearchStars,
cameraTransitioning,
// Add Constellations
showConstellations,
setShowConstellations,
} = useStore();

const {
Expand Down Expand Up @@ -135,14 +138,17 @@ const LevaUI = () => {
},
"Search stars": {
value: searchStars,
hint: "Keep unchecked for best performance",
onChange: setSearchStars,
},
Positions: {
value: showPositions,
hint: "Keep unchecked for best performance",
onChange: setShowPositions,
},
Ephemerides: {
value: ephimerides,
onChange: setEphemerides,
},
},
{ collapsed: false }
),
Expand Down Expand Up @@ -244,6 +250,11 @@ const LevaUI = () => {
step: 100,
onChange: setEquidistantStars,
},
// Added Constellations here
"Constellations": {
value: showConstellations,
onChange: setShowConstellations,
},
"Celestial sphere": {
value: celestialSphere,
onChange: setCelestialSphere,
Expand Down Expand Up @@ -352,4 +363,4 @@ const LevaUI = () => {
);
};

export default LevaUI;
export default LevaUI;
Loading