ImageryLayer.effect Bug 4.19, 4.20

677
3
07-15-2021 05:41 PM
JoelBennett
MVP Regular Contributor

Starting in 4.19, and including 4.20, setting the effect property on instances of ImageryLayer has no effect.  This can be verified in the sandbox for the sample Intro to ImageryLayer.  In the constructor for the layer on line 39, you can add an effect property like so:

 

const layer = new ImageryLayer({
    effect: "grayscale(100%)",
    url:
        "https://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer",
    format: "jpgpng" // server exports in either jpg or png format
});

 

 

When you refresh the sample using the Refresh button at the top-right of the page, you see the layer in full color as before.  Now, go to line 16 and change the API version to 4.18 like so:

 

<script src="https://js.arcgis.com/4.18/"></script>

 

 

When you refresh the sample again, the layer now renders in grayscale, as it should.  Other 4.19 layer types, like FeatureLayer, MapImageLayer, and TileLayer work just fine in this regard; the issue seems limited to ImageryLayer.

I can't fully explain the issue, as I don't fully understand it, but the following workaround is working for me in version 4.19 (I'm unable to verify it in 4.20 since it's not available for download yet).  If you have a locally hosted copy of the API, make the following change in esri\views\2d\layers\ImageryLayerView2D.js:

Search for:

 

this.watch("timeExtent",()=>{

 

Replace with:

 

this.watch("layer.effect",()=>{this.subview.container.effect=this.get("layer.effect")}),this.watch("timeExtent",()=>{

 

 

3 Replies
AnneFitz
Esri Regular Contributor

Hi Joel - thank you for reporting this. We are looking into this bug and hope to have it fixed soon.

0 Kudos
UndralBatsukh
Esri Regular Contributor

Hi there, 

This issue is fixed at version 4.21 and it is planned to be released end of September. You can test the fix by pointing your app to  <script src="https://js.arcgis.com/next/"></script>. 

 

Thanks for reporting this issue, 

-Undral

 

0 Kudos
JoelBennett
MVP Regular Contributor

After upgrading to 4.21, I have found this issue is indeed fixed.  Thank you!

0 Kudos