0.4.0 • Published 10 months ago

map-gl-compass-pro v0.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

map-gl-compass-pro npm npm downloads

OFFICIAL WRAPPER FOR maplibre-compass-pro

Screen

LIVE DEMO

Usage

See Demo App component to get detailed overview how to embed component in react-map-gl based project.

Component props:

type CompassProps = {
    size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
    displayDirection?: boolean;
    visualizePitch?: boolean;
    onClick?: () => void;
};

⚒️⚒️⚒️

import 'maplibre-gl/dist/maplibre-gl.css'
import 'map-gl-compass-pro/dist/style.css'

import MapGL from 'react-map-gl/maplibre'
import Compass from 'maplibre-compass-pro'
import { useState } from 'react'

export function DemoApp() {
	const [compassSize, setCompassSize] = useState('md')
	const [displayDirection, setDisplayDirection] = useState(true)

	return (
		<MapGL
			style={{ width: '100%', height: '100vh' }}
			mapStyle="/<your_map_style>.json"
		>
			<Compass size={compassSize} displayDirection={displayDirection} />
		</MapGL>
	)
}

Please make sure that:

  • compass is child of MapGL component;
  • compass styles are imported in entrypoint;

Up to date react-map-gl setup available here

Enjoy 🗺️🧭

0.3.0

10 months ago

0.2.0

10 months ago

0.4.0

10 months ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.1

2 years ago