Files
2026-10-24 13:20:55 +02:00

208 lines
13 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Review horizon</title>
<script src="./support.js"></script>
</head>
<body>
<x-dc>
<helmet>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&amp;family=IBM+Plex+Mono:wght@400;500&amp;display=swap">
<style>
body{margin:0}
a{color:#F5B544}a:hover{color:#FFD07A}
</style>
</helmet>
<div style="width: 390px; height: 844px; box-sizing: border-box; position: relative; overflow: hidden; background: #0A0D13; color: #E8ECF2; font-family: 'Barlow', system-ui, sans-serif; padding: 56px 20px 0">
<div style="display: flex; align-items: center; gap: 8px">
<a href="Capture.dc.html" aria-label="Back to capture" style="width: 44px; height: 44px; margin-left: -10px; display: flex; align-items: center; justify-content: center; color: #E8ECF2">
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 5l-7 7 7 7"></path></svg>
</a>
<div style="display: flex; flex-direction: column; gap: 2px; flex: 1">
<h1 style="margin: 0; font-size: 22px; font-weight: 700">Review horizon</h1>
<span style="font-size: 13px; color: #93A0B4">24 frames stitched · full 360°</span>
</div>
</div>
<div style="margin-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: #121722; border: 1px solid #232C3B">
<button onClick="{{showProfile}}" style="{{profileTab}}">NINA horizon</button>
<button onClick="{{showPano}}" style="{{panoTab}}">Panorama</button>
</div>
<sc-if value="{{isProfile}}" hint-placeholder-val="{{ true }}">
<div style="margin-top: 12px; display: flex; flex-direction: column; gap: 8px">
<svg width="350" height="250" viewBox="0 0 350 250" role="img" aria-label="Horizon profile: obstruction altitude by azimuth, with the safety margin dashed" style="display: block">
<g stroke="#1E2634" stroke-width="1">
<line x1="30" y1="10" x2="346" y2="10"></line>
<line x1="30" y1="60" x2="346" y2="60"></line>
<line x1="30" y1="110" x2="346" y2="110"></line>
<line x1="30" y1="160" x2="346" y2="160"></line>
</g>
<line x1="30" y1="210" x2="346" y2="210" stroke="#3A4558" stroke-width="1"></line>
<g font-family="IBM Plex Mono, ui-monospace, monospace" font-size="10" fill="#93A0B4" text-anchor="end">
<text x="24" y="14">40°</text>
<text x="24" y="64">30°</text>
<text x="24" y="114">20°</text>
<text x="24" y="164">10°</text>
<text x="24" y="214">0°</text>
</g>
<g font-family="IBM Plex Mono, ui-monospace, monospace" font-size="11" fill="#93A0B4" text-anchor="middle">
<text x="30" y="232">N</text>
<text x="109" y="232">E</text>
<text x="188" y="232">S</text>
<text x="267" y="232">W</text>
<text x="346" y="232">N</text>
</g>
<path d="{{pArea}}" fill="{{accent}}" fill-opacity="0.16"></path>
<path d="{{pLine}}" fill="none" stroke="{{accent}}" stroke-width="1.6" stroke-linejoin="round"></path>
<path d="{{pMargin}}" fill="none" stroke="#6CC3E6" stroke-width="2" stroke-dasharray="5 4" stroke-linejoin="round"></path>
</svg>
<div style="display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: #93A0B4">
<span style="display: flex; align-items: center; gap: 6px"><span style="width: 16px; height: 0; border-top: 2px solid {{accent}}"></span>Detected sky edge</span>
<span style="display: flex; align-items: center; gap: 6px"><span style="width: 16px; height: 0; border-top: 2px dashed #6CC3E6"></span>Written to .hrz</span>
</div>
</div>
<div style="margin-top: 16px; display: flex; flex-direction: column; gap: 8px">
<div style="display: flex; justify-content: space-between; align-items: baseline">
<label for="margin" style="font-size: 15px; font-weight: 600">Safety margin</label>
<span style="font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 15px; color: #6CC3E6">+{{marginTxt}}°</span>
</div>
<input id="margin" type="range" min="0" max="5" step="0.5" value="{{margin}}" onChange="{{onMargin}}" style="width: 100%; height: 28px; accent-color: #6CC3E6; margin: 0">
<span style="font-size: 13px; color: #93A0B4">Keeps NINA targets clear of tree tips and compass error</span>
</div>
</sc-if>
<sc-if value="{{isPano}}" hint-placeholder-val="{{ false }}">
<div style="margin-top: 12px; border-radius: 14px; overflow: hidden; border: 1px solid #232C3B">
<svg width="350" height="210" viewBox="0 0 350 210" role="img" aria-label="Zoomed panorama from east to south: checkered area is transparent sky, the line is the detected edge" style="display: block">
<defs>
<pattern id="checker" width="14" height="14" patternUnits="userSpaceOnUse">
<rect width="14" height="14" fill="#1A2130"></rect>
<rect width="7" height="7" fill="#273042"></rect>
<rect x="7" y="7" width="7" height="7" fill="#273042"></rect>
</pattern>
</defs>
<rect x="0" y="0" width="350" height="210" fill="url(#checker)"></rect>
<path d="{{zArea}}" fill="#2E3A2C"></path>
<path d="{{zGround}}" fill="#3A4436"></path>
<path d="{{zLine}}" fill="none" stroke="{{accent}}" stroke-width="2" stroke-linejoin="round"></path>
<sc-if value="{{isBrush}}" hint-placeholder-val="{{ false }}">
<circle cx="238" cy="58" r="18" fill="{{brushFill}}" fill-opacity="0.25" stroke="#FFFFFF" stroke-width="1.5" stroke-dasharray="3 3"></circle>
</sc-if>
<g font-family="IBM Plex Mono, ui-monospace, monospace" font-size="10" fill="#C9D2DE">
<text x="6" y="203">E 90°</text>
<text x="171" y="203" text-anchor="middle">135°</text>
<text x="344" y="203" text-anchor="end">S 180°</text>
</g>
</svg>
</div>
<div style="margin-top: 8px; display: flex; flex-direction: column; gap: 8px">
<svg width="350" height="40" viewBox="0 0 350 40" role="img" aria-label="Whole 360 degree panorama with the zoomed part outlined" style="display: block">
<rect x="0" y="0" width="350" height="40" rx="6" fill="#1A2130"></rect>
<path d="{{oArea}}" fill="#2E3A2C"></path>
<path d="{{oLine}}" fill="none" stroke="{{accent}}" stroke-width="1.2"></path>
<rect x="87.5" y="1" width="87.5" height="38" rx="4" fill="none" stroke="#E8ECF2" stroke-width="2"></rect>
</svg>
<span style="display: flex; align-items: center; gap: 8px; font-size: 13px; color: #93A0B4">
<svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true"><rect width="14" height="14" fill="#1A2130"></rect><rect width="7" height="7" fill="#3A4558"></rect><rect x="7" y="7" width="7" height="7" fill="#3A4558"></rect></svg>
Transparent sky in Stellarium
</span>
</div>
<div style="margin-top: 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: #121722; border: 1px solid #232C3B">
<sc-for list="{{tools}}" as="t" hint-placeholder-count="3">
<button onClick="{{t.pick}}" style="{{t.style}}">{{t.label}}</button>
</sc-for>
</div>
</sc-if>
<div style="position: absolute; left: 20px; right: 20px; bottom: 102px; display: flex; align-items: center; gap: 10px; background: #121722; border: 1px solid #232C3B; border-radius: 14px; padding: 10px 10px 10px 14px">
<div style="display: flex; flex-direction: column; gap: 2px; flex: 1">
<span style="font-size: 15px; font-weight: 600">North offset</span>
<span style="font-size: 13px; color: #93A0B4">Applies to .hrz and panorama</span>
</div>
<span style="font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 16px; min-width: 56px; text-align: right">{{northTxt}}</span>
<button onClick="{{nDown}}" aria-label="Rotate 0.5 degrees left" style="width: 44px; height: 44px; border-radius: 12px; border: 1px solid #263042; background: #1A2130; color: #E8ECF2; font-size: 20px; padding: 0">−</button>
<button onClick="{{nUp}}" aria-label="Rotate 0.5 degrees right" style="width: 44px; height: 44px; border-radius: 12px; border: 1px solid #263042; background: #1A2130; color: #E8ECF2; font-size: 20px; padding: 0">+</button>
</div>
<div style="position: absolute; left: 20px; right: 20px; bottom: 34px">
<a href="Export.dc.html" style="height: 56px; border-radius: 16px; background: {{accent}}; color: #1A1204; text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 17px; font-weight: 700">
Export
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 5l7 7-7 7"></path></svg>
</a>
</div>
</div>
</x-dc>
<script type="text/x-dc" data-dc-script data-props='{"accent":{"editor":"color","default":"#F5B544","options":["#F5B544","#6CC3E6","#F27A54"]},"$preview":{"width":390,"height":844}}'>
class Component extends DCLogic {
constructor(props) {
super(props);
this.state = { view: 'profile', tool: 'auto', north: 0, margin: 2 };
}
renderVals() {
const accent = this.props.accent ?? '#F5B544';
const prof = [[0,12],[10,14],[20,15],[30,13],[40,9],[50,6],[60,4],[70,3],[80,3],[90,4],[100,8],[110,22],[120,26],[130,24],[140,21],[150,9],[160,5],[170,4],[180,5],[190,7],[200,12],[210,17],[220,19],[230,18],[240,16],[250,12],[260,8],[270,6],[280,5],[290,5],[300,7],[310,10],[320,11],[330,13],[340,14],[350,13],[360,12]];
const f = (n) => n.toFixed(1);
const m = this.state.margin;
const px = (az) => 30 + az / 360 * 316;
const py = (alt) => 210 - Math.min(alt, 40) / 40 * 200;
const pLine = prof.map((p, i) => (i ? 'L' : 'M') + f(px(p[0])) + ' ' + f(py(p[1]))).join(' ');
const pMargin = prof.map((p, i) => (i ? 'L' : 'M') + f(px(p[0])) + ' ' + f(py(p[1] + m))).join(' ');
const pArea = 'M30 210 ' + prof.map((p) => 'L' + f(px(p[0])) + ' ' + f(py(p[1]))).join(' ') + ' L346 210 Z';
const altAt = (az) => {
for (let i = 0; i < prof.length - 1; i++) {
const a = prof[i], b = prof[i + 1];
if (az >= a[0] && az <= b[0]) return a[1] + (b[1] - a[1]) * (az - a[0]) / (b[0] - a[0]);
}
return prof[0][1];
};
const zx = (az) => (az - 90) / 90 * 350;
const zy = (alt) => 138.5 - alt * 3.077;
const zp = [];
for (let az = 90; az <= 180; az += 1.5) {
const tree = altAt(az) > 7 ? Math.sin(az * 2.3) * 1.4 + Math.sin(az * 5.1) * 0.8 : 0;
zp.push([az, altAt(az) + tree]);
}
const zLine = zp.map((p, i) => (i ? 'L' : 'M') + f(zx(p[0])) + ' ' + f(zy(p[1]))).join(' ');
const zArea = 'M0 210 ' + zp.map((p) => 'L' + f(zx(p[0])) + ' ' + f(zy(p[1]))).join(' ') + ' L350 210 Z';
const zGround = 'M0 210 L0 ' + f(zy(0)) + ' L350 ' + f(zy(0)) + ' L350 210 Z';
const ox = (az) => az / 360 * 350;
const oy = (alt) => 40 - (alt + 20) / 65 * 40;
const oLine = prof.map((p, i) => (i ? 'L' : 'M') + f(ox(p[0])) + ' ' + f(oy(p[1]))).join(' ');
const oArea = 'M0 40 ' + prof.map((p) => 'L' + f(ox(p[0])) + ' ' + f(oy(p[1]))).join(' ') + ' L350 40 Z';
const tab = (on) => 'height: 40px; min-width: 0; border-radius: 10px; border: none; font-family: inherit; font-size: 14px; font-weight: 600; background: ' + (on ? '#E8ECF2' : 'transparent') + '; color: ' + (on ? '#0A0D13' : '#E8ECF2');
const tools = [['auto', 'Auto edge'], ['sky', 'Paint sky'], ['ground', 'Paint ground']].map((t) => ({
label: t[1],
pick: () => this.setState({ tool: t[0] }),
style: tab(this.state.tool === t[0])
}));
const isProfile = this.state.view === 'profile';
const n = this.state.north;
return {
accent: accent,
isProfile: isProfile,
isPano: !isProfile,
profileTab: tab(isProfile),
panoTab: tab(!isProfile),
showProfile: () => this.setState({ view: 'profile' }),
showPano: () => this.setState({ view: 'pano' }),
pLine: pLine, pMargin: pMargin, pArea: pArea,
margin: m,
marginTxt: m.toFixed(1),
onMargin: (e) => this.setState({ margin: Number(e.target.value) }),
zLine: zLine, zArea: zArea, zGround: zGround,
oLine: oLine, oArea: oArea,
tools: tools,
isBrush: this.state.tool !== 'auto',
brushFill: this.state.tool === 'sky' ? '#6CC3E6' : '#3A4436',
northTxt: (n > 0 ? '+' : '') + n.toFixed(1) + '°',
nUp: () => this.setState({ north: n + 0.5 }),
nDown: () => this.setState({ north: n - 0.5 })
};
}
}
</script>
</body>
</html>