npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gmap-dragdrop-react

v1.1.2

Published

Drag and Drop React Google Map component

Downloads

12

Readme

Google Maps Drag and Drop with React Component

Drag&drop location markers on&off Google Maps with this React component, not just draggable markers. Internet Explorer has degraded performance but still works thanks to Mihai Valentin.

visual explanation

Live gmap-dragdrop-react examples, takes 150sec to start on free hosting.

Full webserver on GitHub with examples.

Install

$ npm install --save gmap-dragdrop-react

Compile JS

$ gulp

JSX

import {GmapDragDrop} from 'gmap-dragdrop-react'

const CYPRESS = {lat: 49.396, lng: -123.204, title_text: "Cypress Mountain"}
const GROUSE = {lat: 49.380, lng: -123.082, title_text: "Grouse Mountain"}
const SEYMOUR = {lat: 49.367, lng: -122.948, title_text: "Mount Seymour"}
const GOOGLE_MAP_KEY = "abcdefgh**_Google_Map_API_Key_**ijelmen"

ReactDOM.render(<GmapDragDrop
	google_map_key={GOOGLE_MAP_KEY}
	map_locations={[CYPRESS, GROUSE, SEYMOUR]}
	map_options={ init_zoom:7, onAdd:(e)=>{ console.log('added a map location') } }
/>, document.getElementById('gmap-container-id'))

google_map_key

Required Type: string

The 40 character Google API Key

google_map_key={1234567890123456789012345678901234567890}

map_locations

Required
Type: array

Array of locations to display on the map. A location is an object consisting of at least a 'lat' and 'lng' property

		map_locations={ [ ] }

map_options - attributes

Type: object

		map_options={ init_zoom : 7 }

map_options - events

Type: function

		map_options={ onAdd: (e)=>{
    			const {location_data, gmap_event} = e.gmap_params
    			console.log('onAdd : with this data', gmap_event._object_type)
    			console.dir(location_data)
    			return location_data
  		}}

Methods

	import {GmapDragDrop} from 'gmap-dragdrop-react'
	let gmap_drag_drop_instance = ReactDOM.render(<GmapDragDrop
			google_map_key ={"abcdefgh**_Google_Map_API_Key_**ijelmen"}
			map_locations={ [ {lat: 12.34, lng: 12.34} ] }
		/>, document.getElementById('gmap-container-id'))
	let number_locations = gmap_drag_drop_instance.numberLocations()
	console.log('There are currently ' + number_markers + ' on the map')

GmapGroups

Non-Existant API Key

google maps image when bad api key

API Key Not Yet Linked to Credit Card

For developers only

Get a Google Maps API key at https://developers.google.com/maps/documentation/javascript/get-api-key

Restrict API Key for Production

API restrictions

Related

  • setDragImage-IE - setDragImage method support for HTML5 Drag & Drop in Internet Explorer 10+. This method is used to support marker dragging in IE.

Created by

Steen Hansen

License

MIT ©