-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug wherein unsetting and resetting fill-outline-color causes TypeError to be thrown #3657
Comments
I think this is fundamentally a problem involving how default values are handled for paint properties, but I haven't exactly pinpointed the root cause why it's manifesting. My sense from stepping through the debugger is that it's some kind of timing issue with transitions, but that's as much as I've determined so far. |
A crumb of evidence supporting the theory that it's a timing issue: when I put a breakpoint, say, here in StyleLayer, I never see the exception being raised -- even if I just immediately hit the 'continue' button each time the breakpoint trips. |
Okay. I think the underlying issue here is about the special-case handling for default getPaintValue(name, globalProperties, featureProperties) {
if (name === 'fill-outline-color' && this.getPaintProperty('fill-outline-color') === undefined) {
return super.getPaintValue('fill-color', globalProperties, featureProperties);
} else {
return super.getPaintValue(name, globalProperties, featureProperties);
}
} Transitioning either to or from
|
Possible fixes for this, ranked in order of my personal preference:
@jfirebaugh @lucaswoj @mourner thoughts? |
^ I meant to say: the reason I ranked the 'correct' fix last is that @mourner indicated the plan was probably to remove fill-outline-color entirely, so that I figured the extra code complexity/weirdness would not be worth it. |
Reference: mapbox/mapbox-gl-style-spec#240 I'm going to proceed with option 1 above unless there are any objections. |
@anandthakker yes, that sounds like a good option. |
* Hack transition from undefined fill-outline-color Closes #3657 * Check for transition * Use more descriptive var name * Use StyleTransition heirarchy, not private method * Restore missing check for direct (non-transition) value * Remove assert of dubious value
mapbox-gl-js version: master
Using
setPaintProperty(..., 'fill-outline-color', undefined)
( to 'unset' this paint property), and then setting it again to a value causes an exception to be thrown.Example:
Error:
The text was updated successfully, but these errors were encountered: