You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Working with a developer recently I ran into a whole bunch of issues with resetStyle() mostly that its behavior is difficult to predict. Currently it resets the style to whatever the style option on the feature layer is. This means that calling setStyle() will change the behavior of resetStyle().
What the developer was trying to do was this.
On hover make a feature more prominent
When a feature was selected make it extremely prominent
When a feature was selected make all other features less prominent
Using setStyle() for 3 made it impossible to use resetStyle() on the previously hovered/selected features in 1 and 2.
I think resetStyle() should always reset back to the first style ever applied to a layer rather then whatever style option is. This would make the above use case much easier and allow allow better compatibility with Esri Leaflet Renderers for scenarios like the following.
Load a feature layer with a complex renderer.
Create separate styles for when features are selected/hovered
When a feature is selected/hovered change styles of all other features
resetStyle() will now restore the original complex renderer.
Working with a developer recently I ran into a whole bunch of issues with
resetStyle()
mostly that its behavior is difficult to predict. Currently it resets the style to whatever thestyle
option on the feature layer is. This means that callingsetStyle()
will change the behavior ofresetStyle()
.What the developer was trying to do was this.
Using
setStyle()
for 3 made it impossible to useresetStyle()
on the previously hovered/selected features in 1 and 2.I think
resetStyle()
should always reset back to the first style ever applied to a layer rather then whateverstyle
option is. This would make the above use case much easier and allow allow better compatibility with Esri Leaflet Renderers for scenarios like the following.resetStyle()
will now restore the original complex renderer.@jgravois @kneemer What do you think?
The text was updated successfully, but these errors were encountered: