jdlubrano / datamaps-zoomto-plugin

A Datamaps plugin to zoom to coordinates on a Datamaps svg.
MIT License
3 stars 1 forks source link

Readme snippet missing `addPlugin` #6

Closed mikewesthad closed 5 years ago

mikewesthad commented 5 years ago

I stumbled across your plugin earlier, which saved me from quite a few headaches due to me messing up the lat/long => svg translate logic in my code. Thanks for sharing it! I'm new to datamaps, so I might have missed something, but do the snippets in the readme work as is? I think they might be missing map.addPlugin, at least when working with the latest version of datamaps (with webpack).

import Datamap from "datamaps";
import zoomto from "datamaps-zoomto";
const map = new Datamap({ /* ... */ });
map.addPlugin("zoomto", zoomto); // <- this
map.zoomto({ /* ... */ });
jdlubrano commented 5 years ago

Thanks for reaching out. I haven't looked at this plugin in a while; certainly not with the most recent version of Webpack. I will look into this and see what I learn.

jdlubrano commented 5 years ago

@mikewesthad

Thank you for bringing this to my attention. I don't even know if I ever got the import syntax to work through my own efforts, so my previous recommendation would have been to use require to pull in this plugin as a dependency. Your snippet does, however, appear to fix any issues that I had using import, so I will add your example to the README.

mikewesthad commented 5 years ago

👍 thanks!