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
{{ message }}
Repository navigation
Flash when switching from a DDS paint property to a constant #3949
Uncaught TypeError: this.functionInterpolationT is not a function
at StyleDeclaration.calculateInterpolationT (style_declaration.js:58)
at t.i.getPaintInterpolationT (style_layer.js:162)
at ProgramConfiguration.setUniforms (program_configuration.js:193)
at Object.drawCircles [as circle] (draw_circle.js:30)
at Painter.renderLayer (painter.js:271)
at Painter.renderPass (painter.js:254)
at Painter.render (painter.js:213)
at e._render (map.js:1128)
Sorry, this is far from a minimal repro case, but what is happening: after initially creating the style, in step 2 I call map.setPaintProperty('points','circle-radius', p) where p is:
Demo starts off with circle-color being a DDS zoom and property function.
Using map.setPaintProperty(), both setting it from this to a DDS function that is property only or to a literal value breaks the map and gives us this error:
style_declaration.js:70 Uncaught TypeError: this._functionInterpolationT is not a function
at StyleDeclaration.calculateInterpolationT (style_declaration.js:70)
at CircleStyleLayer.getPaintInterpolationT (style_layer.js:172)
at ProgramConfiguration.setUniforms (program_configuration.js:244)
at Object.drawCircles [as circle] (draw_circle.js:30)
at Painter.renderLayer (painter.js:288)
at Painter.renderPass (painter.js:271)
at Painter.render (painter.js:225)
at Map._render (map.js:1388)
Demo itself is setting it to a literal paint property.
On the next frame, before the buffers (with program configuration) have updated on the main thread, the old program configuration tries to calculate an interpolated value but fails because layer.getPaintInterpolationT no longer works (because the layer was already updated to a different property declaration).
Any ideas on how we should handle this race condition? I tried simply returning a 0 interpolation value if the layer is not a zoom-and-property layer. This leads to a flash of incorrect color until the tiles are updated, but is at least better than breaking the map with an error.
For a proper fix that handles all edge cases, I guess we would need to either:
Re-architect the style layer code so that each tile has its own style object which is constructed on the worker side and then reconstructed on the main thread. edit: although it would be weird considering methods like map.getPaintValue which would have to fetch the first rendered tile for the value.
Or do the previously discussed "do not update tiles on screen until they loaded for the whole view", which is a really difficult refactoring.
Should I submit the color flash PR now, and leave difficult refactorings for later?
changed the title [-]this.functionInterpolationT is not a function[/-][+]Error when switching from a DDS paint property to a constant[/+]on Apr 19, 2017
changed the title [-]Error when switching from a DDS paint property to a constant[/-][+]Flash when switching from a DDS paint property to a constant[/+]on Apr 21, 2017
This no longer throws an error as of #4611, just causes a short flash of incorrect value while new buffers are loading, but keeping the issue open in case we want to address it in a way Native does, per @jfirebaugh's comment above.
I just ran into this... took a long time to debug. 😞
In my case I was transitioning the opacity of several layers between being either a constant "0" or "1" or an intermediate value using a property function. An easy workaround was just to use a property function for all of them, but set the property function to effectively return a constant value.
Activity
lucaswoj commentedon Jan 11, 2017
Thanks for the bug report! These symptoms don't look familiar to me.
jfirebaugh commentedon Feb 9, 2017
@stevage I don't see a "Close X" button on the page after following those steps. Would you mind creating a minimal demo?
stevage commentedon Feb 10, 2017
Sorry, I removed the close button in that case because of this bug :) Will create a minimal repro.
jfirebaugh commentedon Mar 23, 2017
Closing here for now; feel free to reopen if this continues to be an issue and you have a chance to create a minimal repro.
aparlato commentedon Apr 18, 2017
Created a minimal demo of this bug in the
circle-colorproperty:https://jsbin.com/bazutat/edit?html,js,console,output
Demo starts off with
circle-colorbeing a DDS zoom and property function.Using map.setPaintProperty(), both setting it from this to a DDS function that is property only or to a literal value breaks the map and gives us this error:
Demo itself is setting it to a literal paint property.
cc @jfirebaugh
mourner commentedon Apr 19, 2017
@jfirebaugh this seems to happen like this:
layer.getPaintInterpolationTno longer works (because the layer was already updated to a different property declaration).Any ideas on how we should handle this race condition? I tried simply returning a
0interpolation value if the layer is not a zoom-and-property layer. This leads to a flash of incorrect color until the tiles are updated, but is at least better than breaking the map with an error.mourner commentedon Apr 19, 2017
For a proper fix that handles all edge cases, I guess we would need to either:
map.getPaintValuewhich would have to fetch the first rendered tile for the value.Should I submit the color flash PR now, and leave difficult refactorings for later?
fix error when switching from DDS to a constant paint value
[-]this.functionInterpolationT is not a function[/-][+]Error when switching from a DDS paint property to a constant[/+]jfirebaugh commentedon Apr 19, 2017
Native handles this by:
fix error when switching from DDS to a constant paint value
[-]Error when switching from a DDS paint property to a constant[/-][+]Flash when switching from a DDS paint property to a constant[/+]mourner commentedon Apr 21, 2017
This no longer throws an error as of #4611, just causes a short flash of incorrect value while new buffers are loading, but keeping the issue open in case we want to address it in a way Native does, per @jfirebaugh's comment above.
ChrisLoer commentedon Aug 23, 2017
I just ran into this... took a long time to debug. 😞
In my case I was transitioning the opacity of several layers between being either a constant "0" or "1" or an intermediate value using a property function. An easy workaround was just to use a property function for all of them, but set the property function to effectively return a constant value.
Workaround for flicker caused by mapbox/mapbox-gl-js#3949.
jfirebaugh commentedon Oct 27, 2017
→ #4012