Question about upcoming JS API 4.11 Release

775
6
Jump to solution
03-20-2019 03:26 AM
RomanKönig
New Contributor III

This is a question mainly for the JS API developers at esri - Undral Batsukh Yann Cabon 

We've seen that the 4.11 release (maybe alpha, beta?) of the API is already online and tried a few things using this api in our own development application.

Now we found an unexpected behavior regarding GraphicsLayer, which handled different in 4.10 and before.

So my question is - does it make sense to file such a sample?
If yes, where should we do that?

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi Roman, 

Sorry for the late reply. I was out of the office.  The change happened because graphics can only have one owner. Graphics were never meant to be shared in multiple layers. The way it worked before is really a bug.

The problem is that there is only one Graphic.layer and change notifications would only appear in one view and not in the other we now strictly enforce this, so there are no surprises.

However, it seems you can still add the same graphic to multiple view.graphics. I think this shouldn’t be the case. I will investigate. 

Thanks,

-Undral

View solution in original post

6 Replies
UndralBatsukh
Esri Regular Contributor

Hi Roman,

Can you please post your sample and the issue description here? 

Thank you so much,

Undral

RomanKönig
New Contributor III

Thanks for your quick response, Undral. I tagged you because you already answered to my earlier posts regarding using graphics .

When adding a single Graphic object to two different MapViews (e.g. Map and connected map or overview) the Graphic is removed from the 1st MapView when added to the 2nd. This happens only if we use an additional GraphicsLayer and not when added to the default graphics of the view.

This was different in 4.9 and 4.10 - so we just generated our graphics and added the to the views.

Maybe this is a known breaking change, we just need to make sure before we change our handling of graphics.

sample:

- generates 2 views each with its own GraphicsLayer

- adds Graphics objects to GraphicsLayer and default graphics of view 1 (timeout)

- adds the same Graphics objects to GraphicsLayer and default graphics of view 2 (timeout)

==> Polygon on GraphicsLayer of View 1 is deleted

0 Kudos
UndralBatsukh
Esri Regular Contributor

Hi there,

OK I confirmed that it is a breaking change. A graphic can only be in one layer at a time. When adding a graphic to a graphicslayer, and if it is already in another graphicslayer, the graphic is **moved** to the destination graphicslayer.

We will a note about it in Release Notes for 4.11. Hope this is clear and answers your question. 

Undral

RomanKönig
New Contributor III

So you mean this is a wanted behaviour?

But then why is this only for GraphicsLayer and not for the defaults graphics of a view?

I think it was better and more useful like it was handled in 4.10. The usage of Graphics seems to get more and more complicated than it gets easier.

0 Kudos
UndralBatsukh
Esri Regular Contributor

Hi Roman, 

Sorry for the late reply. I was out of the office.  The change happened because graphics can only have one owner. Graphics were never meant to be shared in multiple layers. The way it worked before is really a bug.

The problem is that there is only one Graphic.layer and change notifications would only appear in one view and not in the other we now strictly enforce this, so there are no surprises.

However, it seems you can still add the same graphic to multiple view.graphics. I think this shouldn’t be the case. I will investigate. 

Thanks,

-Undral

RomanKönig
New Contributor III

Thanks for your reply! This clears things up.

0 Kudos