Repository navigation
Only restyle own paths in TimeSliderChoropleth - #2390
Open
VolodymyrLinuxovich wants to merge 1 commit into
Open
VolodymyrLinuxovich wants to merge 1 commit into
VolodymyrLinuxovich wants to merge 1 commit into
Conversation
The overlay add handler selected every path on the page and reset its stroke and fill opacity. Other GeoJson layers on the same map lost their style and the Leaflet attribution flag went blank. Select only the paths that belong to this layer.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TimeSliderChoropleth styles its features when the layer is added. It did this with
d3.selectAll('path'), which picks up every SVG path on the page. So any other GeoJson layer on the same map got a thin white dashed stroke and a fill opacity of zero. The small flag in the Leaflet attribution went blank too.I checked this in a headless browser with a red and blue GeoJson polygon next to a slider layer. Before the change the polygon came out white, dashed and unfilled. After the change it keeps its own style and the slider features look the same as before.
The selector now only matches paths whose id starts with the layer's feature prefix. Those ids are set a few lines above in the same handler. I added a test that checks the rendered script uses the scoped selector.