cutting-room-floor / markers.js

DEPRECATED: USE MAPBOX.JS
http://mapbox.com/mapbox.js
BSD 3-Clause "New" or "Revised" License
18 stars 9 forks source link

Allow re-adding feature with the same key #52

Closed Swatinem closed 11 years ago

Swatinem commented 11 years ago

markers.js keeps a cache of markers used for a feature to not re-create the marker when a feature is repositioned. That cache is however never cleared when a feature is removed, making it impossible to re-add the same feature after removing it once.

tmcw commented 11 years ago

Looks great, merging!

Swatinem commented 11 years ago

Wow that was fast :-)

Well there is however a slight problem because the interaction abuses markers to create tooltips. Those end up with marker.data being an empty object. Users of the key function should be aware of that.

So key(function (f) { return f.properties.id; }) yields a TypeError because f.properties is undefined. In my case I just dealt with this inside the key function itself, not sure how to solve it in a better way.