@event-globe/solid
v1.1.0
Published
Managed renderer for Three.js globe visualization with automatic resizing and controls
Maintainers
Readme
@event-globe/solid
Solid.js wrapper for the Event Globe 3D visualization library.
Installation
npm install @event-globe/solidUsage
import { EventGlobe } from '@event-globe/solid'
import type { EventGlobeRef } from '@event-globe/solid'
export default function App() {
let globeRef!: EventGlobeRef
const config = {
autoRotate: true,
autoRotateSpeed: 0.3,
globe: {
globeColor: '#3a228a',
showLandPolygons: true,
},
}
function addRandomEvent() {
globeRef?.addEvent('arc', {
lat: (Math.random() * 180) - 90,
lng: (Math.random() * 360) - 180,
endLat: (Math.random() * 180) - 90,
endLng: (Math.random() * 360) - 180,
color: '#DD63AF',
showEndRipple: true,
})
}
return (
<div class="globe-container" style={{ width: '100%', height: '600px' }}>
<EventGlobe ref={globeRef} config={config} />
<button onClick={addRandomEvent}>Add Event</button>
</div>
)
}API
Props
config?: EventGlobeRendererConfig- Configuration options for the globestyle?: string | Record<string, string>- Additional inline stylesclass?: string- CSS class nameref?: (ref: EventGlobeRef) => void- Callback ref for accessing methodsonArcRemoved?: (id: number, options: ArcOptions) => void- Callback when an arc is removed
Ref Methods
Access these methods via the ref callback:
import { EventGlobe } from '@event-globe/solid'
export default function App() {
let globeRef!: EventGlobeRef
// Access methods
const handleAddEvent = () => {
globeRef?.addEvent('arc', {
lat: 40.7128,
lng: -74.0060,
endLat: 51.5074,
endLng: -0.1278,
})
}
const count = () => globeRef?.getActiveArcCount() ?? 0
return <EventGlobe ref={globeRef} />
}addEvent<TGlobeEvent extends GlobeEvents>(event: TGlobeEvent, options: GlobeEventOptionsMap[TGlobeEvent]): GlobeEventLifecycle<TGlobeEvent> | undefined
Add an event and receive a lifecycle for awaiting removal or removing it early.
removeAllEvents(): void
Remove all active events from the globe.
addArc(options: ArcOptions): number
Deprecated alias for addEvent().
getActiveArcCount(): number
Deprecated method that returns the current number of active arcs. It will be removed in a future release.
removeArcById(id: number): void
Remove a specific arc by its ID.
clearAllArcs(): void
Deprecated alias for removeAllEvents().
Full API Reference
For complete configurations and options, see the @event-globe/core and @event-globe/ts packages.
License
MIT
