Skip to content

Commit

Permalink
remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
stromseng committed May 9, 2024
1 parent 11d465f commit 92215d6
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions frontend/src/app/_homeComponents/SatelliteGlobe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ interface initpostype {
export default function SatelliteGlobe() {
const chart = useRef<HTMLDivElement>(null);
const globeRef = useRef<GlobeInstance>();
const wrapperRef = useRef<HTMLDivElement>(null);
const { selectedSatellite, setSelectedSatellite, satNumToEntry } =
useSatelliteStore((state) => ({
selectedSatellite: state.selectedSatellite,
Expand Down Expand Up @@ -65,20 +64,20 @@ export default function SatelliteGlobe() {

// lock the initial height of the globe
const setGlobeSize = () => {
if (globeRef.current && chart.current && wrapperRef.current) {
if (globeRef.current && chart.current) {
const { width } = chart.current.getBoundingClientRect();

globeRef.current.width(width);
if (typeof window !== "undefined") {
let windowWidth = window.innerWidth;
let windowHeight = window.innerHeight;

// If the window width is less than 640, disable controls
// If the window width is less than 768, disable controls and set height to window height
if (windowWidth <= 768) {
globeRef.current.controls().enabled = false;
globeRef.current.controls().enableRotate = false;
globeRef.current.height(windowWidth); // Minus navbar height and stats height
// Enable touch action
// Set touch action to auto to allow for scrolling on mobile
let globeElement =
globeRef.current.renderer().domElement;
globeElement.style.touchAction = "auto";
Expand Down Expand Up @@ -200,13 +199,5 @@ export default function SatelliteGlobe() {
return () => clearInterval(intervalId);
}, [satNumToEntry, selectedSatellite]);

return (
<div
className="h-full w-full"
ref={wrapperRef}
onTouchMove={(e) => e.stopPropagation()}
>
<div id="chart" ref={chart}></div>
</div>
);
return <div id="chart" ref={chart}></div>;
}

0 comments on commit 92215d6

Please sign in to comment.