-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
864 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
components/molecules/ExplorerControls/Orientation/_styles.scss
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
components/molecules/ExplorerControls/Orientation/index.jsx
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
components/molecules/ExplorerControls/Orientation/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"use client"; | ||
import { FC, useCallback, useState } from "react"; | ||
import ViewIndicator from "@rubin-epo/epo-widget-lib/ViewIndicator"; | ||
import { useAladin } from "@/contexts/Aladin"; | ||
|
||
const Orientation: FC<{ className?: string }> = ({ className }) => { | ||
const [fov, setFov] = useState<[number, number] | undefined>(); | ||
const [position, setPosition] = useState<[number, number] | undefined>(); | ||
|
||
const onPositionChanged: AladinGenericCallback = useCallback( | ||
({ ra, dec }) => { | ||
setPosition([ra, dec]); | ||
}, | ||
[] | ||
); | ||
|
||
const onZoomChanged: AladinGenericCallback = useCallback((newFov: number) => { | ||
const fov = (aladin?.getFov() || [newFov, newFov]).map((fov) => | ||
Math.max(1, fov) | ||
); | ||
setFov(fov as [number, number]); | ||
}, []); | ||
|
||
const { aladin } = useAladin({ | ||
callbacks: { | ||
onPositionChanged, | ||
onZoomChanged, | ||
onLoaded: (aladin) => { | ||
const position = aladin.getRaDec(); | ||
const fov = aladin.getFov(); | ||
|
||
setPosition(position); | ||
setFov(fov); | ||
}, | ||
}, | ||
}); | ||
|
||
return ( | ||
<ViewIndicator | ||
className={className} | ||
ra={position ? position[0] : undefined} | ||
dec={position ? position[1] : undefined} | ||
fov={fov} | ||
size="var(--size-spacing-l)" | ||
/> | ||
); | ||
}; | ||
|
||
Orientation.displayName = "Molecule.Orientation"; | ||
|
||
export default Orientation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@use "abstracts/_functions"; | ||
|
||
.controlsSubmenu { | ||
position: absolute; | ||
z-index: functions.z-stack(controls); | ||
} | ||
|
||
.viewControls { | ||
composes: controlsSubmenu; | ||
top: 0; | ||
right: 0; | ||
display: grid; | ||
grid-template-columns: 1fr 1fr; | ||
grid-template-rows: 1fr 1fr; | ||
grid-template-areas: | ||
"markers orientation" | ||
". grid"; | ||
gap: var(--size-spacing-2xs); | ||
list-style: none; | ||
} | ||
|
||
.markers { | ||
grid-area: markers; | ||
} | ||
.orientation { | ||
grid-area: orientation; | ||
} | ||
.grid { | ||
grid-area: grid; | ||
} | ||
|
||
.zoomContainer { | ||
composes: controlsSubmenu; | ||
top: calc(50% - 50px); | ||
right: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,9 @@ | |
gap: var(--size-spacing-s); | ||
justify-content: flex-end; | ||
} | ||
|
||
.orientation { | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
} |
Oops, something went wrong.