4.29 Breaking Change: MapView.goTo w/ rotation

265
3
03-29-2024 06:13 PM
JoelBennett
MVP Regular Contributor

The 4.29 implementation of MapView.goTo has changed in an undocumented way that produces different results than 4.28 and prior, particularly in regards to rotation.  Our framework allows the user to change the map rotation via various means, and we use goTo in order to animate the change in rotation, rather than setting the rotation property directly (which causes an instant change).

In code, it looks like this:

view.goTo({rotation:rotation});

 

When doing this in 4.28 and prior, the map scale was preserved, but not the extent.  Starting in 4.29, the extent is preserved, but not the scale.  In order to visualize this, see the images below.  The first one is the starting state, where rotation is zero (i.e. North is "up"):

rotation_1.png

 

Now, let's say the user wants to rotate the map 90 degrees counter-clockwise so that East is "up".  (In the code, we'd set the rotation value to 270.)  Here's what it looks like in 4.28:

rotation_428.png

 

We see the scale has stayed the same, which is the expected behavior.  However, here's what it looks like in 4.29:

rotation_429.png

 

We see that the map has zoomed out one level in this case.  Were my browser maximized at the time, it would've zoomed out two levels instead.  If the user were to repeat this process, the map would continue to zoom out each time.

Fortunately, this is fairly easy to work around by adding the "center" and "scale" properties in the call to goTo:

view.goTo({
	rotation: rotation,
	center: view.center.clone(),
	scale: view.scale
});

 

On a side note, simply setting the rotation property directly continues to work as before, where scale is preserved.

0 Kudos
3 Replies
UndralBatsukh
Esri Regular Contributor

Hi there Joel, 

Thank you very much for reporting this issue! So yes we did change the MapView.goTo() behavior to go to the entire extent of the given geometry while considering the view.rotation. At 4.28, goTo looked liked this 

Screenshot 2024-04-01 at 10.16.59 AM.png

We changed this behavior to show the whole extent 

Screenshot 2024-04-01 at 10.17.06 AM.png

With this behavior change, we introduced the bug you describe. I will create an issue to fix this bug. Thank you very much for putting the workaround here too. I will update you once we have a fix.

UndralBatsukh
Esri Regular Contributor

Hi there, 

We addressed the issue and the fix will be available on https://js.arcgis.com/next after next Tuesday. Please test it out and let us know if it is working as expected. 

Thank you again for reporting this issue.

-Undral

AddisonShaw
New Contributor III

I've asked this before, but wanting to confirm again. Are patch release notes posted anywhere?

0 Kudos