Skip to content
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

Setting the same value with setLayoutProperty triggers render event #7648

Closed
DannyDelott opened this issue Nov 30, 2018 · 2 comments
Closed

Comments

@DannyDelott
Copy link
Contributor

mapbox-gl-js version:
0.51.0

browser:
Chrome

Background

My application subscribes to the map's render event for many reasons, eg: showing a spinner while the map renders tiles/layers.

I notice we get flickers of a spinner when calling setLayoutProperty on a layer and passing the same value that's already in the layer.

Steps to Trigger Behavior

  1. Call setLayoutProperty on a known, visible layer
  2. Set the visibility property to visible
  3. Set the visibility property to visible again

Link to Demonstration

Click the "Test" button in this jsbin:
https://jsbin.com/faqupawuho/1/edit?console,output

Expected Behavior

Calling map.setLayoutProperty('some-layer', 'visibility', 'visible') when the layer is already visible should be a no-op.

Actual Behavior

Two render events fire (see console logs in the JSBin example)

@weiliang903
Copy link

same issue for me.
this.map.setPaintProperty(this._rainfallId, 'raster-opacity', visible ? 0.6 : 0);
it's working

@mourner
Copy link
Member

mourner commented Mar 21, 2019

This was likely fixed by #7459. I'll reopen if it's not the case.

@mourner mourner closed this as completed Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants