leaflet-dvf
leaflet-dvf copied to clipboard
Compatibility with leaflet-0.8-dev
Hi there, great great work. I'd like to use your gradient feature for polygons with the 0.8-dev version but they have a big changelog that makes leaflet-dvf not yet compatible. Where should I start to code to make this feature compatible ? If I could have some tips to begin with ...
Thanks for pointing this out. I wasn't aware that 0.8-dev had breaking changes. I have noticed that there are renderers now. I will investigate further and get back to you, but let me know if you have any ideas or want to tackle this. Basically, the path gradient functionality appears in the src/leaflet.dvf.markers.js file in the PathFunctions definition. I'm essentially overriding the default _updateStyle function for a path, calling the base _updateStyle and then apply the extra gradient stuff to the SVG element that gets created. For 0.8-dev, it seems like we could try overriding the default _updateStyle behavior for the SVG renderer in a similar way.
I've started looking into this. It turns out to be a little more complicated than I originally thought, so it's taking some time to implement - particularly in trying to ensure that the code is compatible with versions prior to 0.8-dev. I'm part of the way there, but there are a lot of changes in 0.8-dev that are making it challenging.
0.8-dev has a lot of good improvements, I use it for its velocity, but all the API changes make the head spin when trying to upgrade plugins.
Do you have any sort of ETA on 0.8 compatibility? I have a need for SVG markers and this project has everything (and more).
Should hopefully be in the next few weeks. I think I have a better handle on the 0.8 changes and have started to look into this more. It's really just a matter of finding the time to work on it. I'll try to keep this thread updated as I make progress. In the meantime, if you or @syldor have any suggestions on the best way to transition features, let me know. I'll definitely make this one of my top priorities.
I need to have something working, if only marginally, this week. I have a couple of days that I can commit to working on this and would be happy to contribute to dvf if possible. I spent some time last week hacking up leaflet-dvf.markers.js to see if I could quickly work around the issues but I didn't get anything working. I also spent a bit of time looking into the structural changes required and I don't have a good idea yet of what approach should be taken.
I'm not sure how to maintain compatibility with both versions given the major architectural shift in vector rendering between 07 and 0.8. I'm not convinced there would be benefit to dvf to maintain backwards compatibility with 0.7. It would probably be better to have a 0.8 compatible branch and separate release of dvf when leaflet 0.8 is released and just move the whole project forward at that point.
Have you started a branch or fork to which I could contribute? Do you have any existing changes that I could build on? Do you have any ideas on how to approach this that I can take into consideration?
I've created a branch for this but haven't pushed it up yet. I'll do that. I was originally focused on trying to write it so that it would work with both 0.8 dev and 0.7 and below, but as you've alluded to, that's probably not feasible. The branch is definitely in a state of disrepair ;) but it works better with 0.8 than the master branch does. If you let me know what features you need this week, I can try to focus on making those work. You mentioned SVG markers, which is what I'm currently focused on at the moment.
I pushed up the branch [0.8dev]. Definitely a mess right now but some stuff sort of works. I'll let you know when I get the SVG marker stuff working. Let me know if there are features you need more than others.
awesome, thanks. I was just working through proposing some changes to get things working but I didn't test yet what I've attempted. I'll take a look at your branch and see what your approach is.
My needs are actually really simple at the moment - I would like to have a marker on the map that is managed by the SVG renderer. The marker would have some kind of 'pin' style with an embedded image (or svg) based on some type for the point. I also need a way to put text on the map using SVG.
PR #39 contains some simple fixes to get the markers.html example running.
I notice you haven't dealt with defs yet. I had two thoughts on how to deal with this:
- add some methods to L.SVG and the renderer for managing defs globally within the svg container
- on first call to _update, point _innerPath (or something) to the path object, change _path into a
, add and _innerPath to it, and change all _path references in the code to _innerPath
but then I don't really know what I'm doing yet :)
With #43 most of the examples are working with 0.8. There are some outstanding issues noted in the PR, including:
- performance (seems related to drop shadows)
- hover destroys style on some marker types
- sochistats, weather no longer work due to API changes
#44 fixes the hover effect on chart markers (and another bug related to centering images on regular polygon markers).
@sfairgrieve have you started to work on the SVG marker? It seems that MapMarker and RegularPolygonMarker won't quite fit the bill so I'd like to try using SVGMarker and see if fits our use case better. I will take a stab at it if you haven't already started on it.
In case you haven't, see #46. Please feel free to close that PR if you have a solution already.