-
Notifications
You must be signed in to change notification settings - Fork 0
Add landscape composite horizon directions and annotation toggle #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -34,6 +34,30 @@ const TOTALITY_MOON_COLOR = TOTALITY_SKY_COLOR; | |||||
| const TOTALITY_MOON_BORDER_COLOR = "#1f2c47"; | ||||||
| const TOTALITY_HORIZON_LINE_COLOR = "rgba(255, 174, 205, 0.75)"; | ||||||
| const TOTALITY_HORIZON_GLOW_COLOR = "rgba(255, 136, 182, 0.42)"; | ||||||
| const LANDSCAPE_HORIZONTAL_FOV_DEG_24MM = 74; | ||||||
| const COMPASS_MARKERS = [ | ||||||
| { label: "N", azimuthDeg: 0 }, | ||||||
| { label: "NNE", azimuthDeg: 22.5 }, | ||||||
| { label: "NE", azimuthDeg: 45 }, | ||||||
| { label: "ENE", azimuthDeg: 67.5 }, | ||||||
| { label: "E", azimuthDeg: 90 }, | ||||||
| { label: "ESE", azimuthDeg: 112.5 }, | ||||||
| { label: "SE", azimuthDeg: 135 }, | ||||||
| { label: "SSE", azimuthDeg: 157.5 }, | ||||||
| { label: "S", azimuthDeg: 180 }, | ||||||
| { label: "SSW", azimuthDeg: 202.5 }, | ||||||
| { label: "SW", azimuthDeg: 225 }, | ||||||
| { label: "WSW", azimuthDeg: 247.5 }, | ||||||
| { label: "W", azimuthDeg: 270 }, | ||||||
| { label: "WNW", azimuthDeg: 292.5 }, | ||||||
| { label: "NW", azimuthDeg: 315 }, | ||||||
| { label: "NNW", azimuthDeg: 337.5 }, | ||||||
| ] as const; | ||||||
|
|
||||||
| function normalizeSignedDeltaDeg(fromDeg: number, toDeg: number) { | ||||||
| const delta = ((toDeg - fromDeg + 540) % 360) - 180; | ||||||
| return delta === -180 ? 180 : delta; | ||||||
| } | ||||||
|
Comment on lines
+57
to
+60
|
||||||
|
|
||||||
| export type PhotographyGuidePayload = { | ||||||
| eclipseId: string; | ||||||
|
|
@@ -89,6 +113,7 @@ export default function PhotographyGuideScreen({ | |||||
| const [totalPictures, setTotalPictures] = useState<PhotographyGuidePictureCount>(5); | ||||||
| const [isCountPickerOpen, setIsCountPickerOpen] = useState(false); | ||||||
| const [isLandscapeCompositeOpen, setIsLandscapeCompositeOpen] = useState(false); | ||||||
| const [showCompositeMarkings, setShowCompositeMarkings] = useState(true); | ||||||
| const [compositeStageSize, setCompositeStageSize] = useState({ | ||||||
| width: 0, | ||||||
| height: 0, | ||||||
|
|
@@ -184,6 +209,22 @@ export default function PhotographyGuideScreen({ | |||||
| if (typeof activeCompositeHorizonY !== "number") return undefined; | ||||||
| return Math.max(0, compositeStageSize.height - activeCompositeHorizonY); | ||||||
| }, [activeCompositeHorizonY, compositeStageSize.height]); | ||||||
| const horizonCompassMarkers = useMemo(() => { | ||||||
| if (!compositeLayout) return []; | ||||||
| const maxPlacement = compositeLayout.placements.find( | ||||||
| (placement) => placement.phaseBucket === "MAX" && typeof placement.sunAzimuthDeg === "number", | ||||||
| ); | ||||||
| if (!maxPlacement || typeof maxPlacement.sunAzimuthDeg !== "number") return []; | ||||||
| const centerAzimuthDeg = maxPlacement.sunAzimuthDeg; | ||||||
|
|
||||||
| return COMPASS_MARKERS.map((marker) => { | ||||||
| const deltaDeg = normalizeSignedDeltaDeg(centerAzimuthDeg, marker.azimuthDeg); | ||||||
| const x = | ||||||
| compositeLayout.anchorX + | ||||||
| (deltaDeg / LANDSCAPE_HORIZONTAL_FOV_DEG_24MM) * compositeStageSize.width; | ||||||
| return { ...marker, x, inFrame: x >= 0 && x <= compositeStageSize.width }; | ||||||
| }).filter((marker) => marker.inFrame); | ||||||
| }, [compositeLayout, compositeStageSize.width]); | ||||||
| const handleCompositeStageLayout = (event: LayoutChangeEvent) => { | ||||||
| const nextWidth = Math.round(event.nativeEvent.layout.width); | ||||||
| const nextHeight = Math.round(event.nativeEvent.layout.height); | ||||||
|
|
@@ -363,6 +404,16 @@ export default function PhotographyGuideScreen({ | |||||
| /> | ||||||
| <View style={styles.compositeModal}> | ||||||
| <Text style={styles.compositeModalTitle}>Landscape composite</Text> | ||||||
| <Pressable | ||||||
| style={styles.compositeMarkingsToggleBtn} | ||||||
| onPress={() => setShowCompositeMarkings((current) => !current)} | ||||||
| accessibilityRole="button" | ||||||
| accessibilityLabel="Toggle composite markings" | ||||||
| > | ||||||
| <Text style={styles.compositeMarkingsToggleText}> | ||||||
| {showCompositeMarkings ? "Hide" : "Show"} markings, directions, and shot numbers | ||||||
|
c0d3rb4b4 marked this conversation as resolved.
|
||||||
| </Text> | ||||||
| </Pressable> | ||||||
| <View style={styles.compositeFrame} onLayout={handleCompositeStageLayout}> | ||||||
| <View | ||||||
| style={[ | ||||||
|
|
@@ -402,6 +453,26 @@ export default function PhotographyGuideScreen({ | |||||
| : null, | ||||||
| ]} | ||||||
| /> | ||||||
| {showCompositeMarkings && typeof activeCompositeHorizonY === "number" | ||||||
| ? horizonCompassMarkers.map((marker) => ( | ||||||
| <View key={`horizon-marker-${marker.label}`} style={{ left: marker.x - 10 }}> | ||||||
| <View | ||||||
| style={[ | ||||||
| styles.compositeDirectionTick, | ||||||
| { top: activeCompositeHorizonY - 6 }, | ||||||
|
||||||
| { top: activeCompositeHorizonY - 6 }, | |
| { top: activeCompositeHorizonY - 6, left: 10 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codex check this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
- Fixed the horizon compass tick alignment in the landscape composite overlay by adding a horizontal offset (
left: 10) to the tick style, so each tick now centers on the same azimuth line as its corresponding label. apps/mobile/src/screens/PhotographyGuideScreen.tsxL456-L468 - Committed the change on the current branch with message:
Fix horizon marker tick centering in composite overlay.
Testing
- ✅
pnpm -C apps/mobile typecheck ⚠️ Screenshot not captured: this is a React Native mobile screen change and there is no runnable browser target in this environment to renderPhotographyGuideScreenvia the browser tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LANDSCAPE_HORIZONTAL_FOV_DEG_24MMis defined here and also inapps/mobile/src/utils/photographyGuide.ts(same value). Duplicating this constant risks the UI compass markers drifting out of sync with the layout math if one side changes. Consider exporting the FOV constant from the utils module (or a shared constants module) and reusing it here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codex Consider this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
photographyGuide.ts(LANDSCAPE_HORIZONTAL_FOV_DEG_24MMandnormalizeSignedDeltaDeg). apps/mobile/src/screens/PhotographyGuideScreen.tsxL17-L24 apps/mobile/src/utils/photographyGuide.tsL51-L53 apps/mobile/src/utils/photographyGuide.tsL119-L122left: 10inside the wrapper). apps/mobile/src/screens/PhotographyGuideScreen.tsxL453-L471showCompositeMarkings. apps/mobile/src/screens/PhotographyGuideScreen.tsxL484-L578aa270c4) and created a follow-up PR viamake_pr.Testing
pnpm -C apps/mobile test tests/photography-guide.test.tspnpm -C apps/mobile typecheckN/A (React Native screen change; browser screenshot capture is not applicable in this environment)View task →