Socket
Socket
Sign inDemoInstall

@openglobus/react

Package Overview
Dependencies
3
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @openglobus/react

Openglobus React Components


Version published
Maintainers
2
Created

Readme

Source

React port for OpenGlobus

Openglobus React Components

Install:

npm i @openglobus/react

Example of usage:

App.tsx

import '@openglobus/react/dist/style.css'
import Globus, {GlobeContextProvider} from '@openglobus/react'


function App() {
    return <GlobeContextProvider>
        <Globus/>
    </GlobeContextProvider>
}

export default App


Button.tsx

import {useGlobeContext} from '@openglobus/react'
// import './buttons.css'
import {LonLat} from "@openglobus/og";


export default function ButtonContainer() {
    const {globe} = useGlobeContext()
    const clickFlyTo = () => {
        let ell = globe?.planet.ellipsoid;

        let destPos = new LonLat(10.13176, 46.18868, 10779);
        let viewPoi = new LonLat(9.98464, 46.06157, 3039);
        if (ell) {
            let lookCart = ell.lonLatToCartesian(viewPoi);
            let upVec = ell.lonLatToCartesian(destPos).normalize();
            globe?.planet.camera.flyLonLat(destPos, lookCart, upVec, 0);
        }
    }

    return <div className={'button-container'}>
        <button onClick={clickFlyTo}>Fly to</button>
    </div>
}

Keywords

FAQs

Last updated on 27 Nov 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc