Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
pigeon-maps
Advanced tools
Demo: https://mariusandra.github.io/pigeon-maps/ (using maps from Wikimedia)
Tired of waiting 5 seconds to include 200kb of gzipped Google Maps JavaScript code just to display a few tiles and a marker?
Welcome to the club!
This project aims to provide a performance-first React-centric extendable map engine.
We're currently at:
Implemented:
Missing:
yarn add pigeon-maps
import Map, { Overlay } from 'pigeon-maps'
const map = (
<Map center={[50.879, 4.6997]} zoom={12} width={600} height={400}>
<Overlay position={[50.879, 4.6997]} offset={[15, 31]}>
<img src='pin@2x.png' width={29} height={34} alt='' />
</Overlay>
</Map>
)
center - Coordinates of the map center in the format [lat, lng]
zoom - Current zoom level 12
width - Width of the component in pixels. Must be set.
height - Height of the component in pixels. Must be set.
provider - Function that returns a TMS URL: (x, y, z) => url
.
animate - Animations enabled, true
.
attribution - What to show as an attribution. React node or false
to hide.
attributionPrefix - Prefix before attribution. React node or false
to hide.
onClick - When map is clicked `function ({ event, latLng, pixel })``
onBoundsChanged - When the bounds change, function ({ center, zoom, bounds })
. Use this for a controlled component, then set center
and zoom
when it's called.
<Map />
takes random React components as its children. The children may have these special props:
position - Coordinates of the element in the format [lat, lng]
. These will be converted to pixels and passed as left
and top
to the child.
offset - Amount of pixels to subtract from the left
and top
props.
The children get passed these special props:
left - Pixels from the left of the map, calculated from position
and offset
top - Pixels from the top of the map, calculated from position
and offset
latLngToPixel - A helper function (latLng, center, zoom)
that returns the position in pixels [x, y]
for any [lat, lng]
. The last 2 arguments are optional.
pixelToLatLng - A helper function (pixel, center, zoom)
that converts any pixel coordinates [x, y]
to [lat, lng]
. The last 2 arguments are optional.
Use these two functions to create beautiful widgets. See the example marker component.
Add the class pigeon-drag-block
to disable dragging on the overlay. Add the class pigeon-click-block
to disable map background clicks on the element.
Alternatively use the <Overlay />
component. It accepts position
, offset
and classNames
as its props and positions itself accordingly.
Pigeon image by Robert Claypool
FAQs
ReactJS maps without external dependencies
The npm package pigeon-maps receives a total of 5,176 weekly downloads. As such, pigeon-maps popularity was classified as popular.
We found that pigeon-maps demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.