<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ArcGIS API for JavaScript 4.x - Zoom to Previous Extent and Zoom to Next Extent Supported? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-javascript-4-x-zoom-to-previous/m-p/1143717#M76335</link>
    <description>&lt;P&gt;Hello everyone.&amp;nbsp; Working on updating some applications from the JS API 3.x environment to the JS API 4.x environment.&lt;/P&gt;&lt;P&gt;I am looking to add in a button for a Zoom to Previous Extent and a button for Zoom to Next Extent.&amp;nbsp; I am looking at the API reference, but do not find anything.&lt;/P&gt;&lt;P&gt;Is there anything in JS API 4.x that is like this?&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/navigation.html#zoomtonextextent" target="_blank" rel="noopener"&gt;zoomToNextExtent()&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/navigation.html#zoomtoprevextent" target="_blank" rel="noopener"&gt;zoomToPrevExtent()&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I am looking, but not finding anything.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Feb 2022 17:21:22 GMT</pubDate>
    <dc:creator>ipeebles</dc:creator>
    <dc:date>2022-02-14T17:21:22Z</dc:date>
    <item>
      <title>ArcGIS API for JavaScript 4.x - Zoom to Previous Extent and Zoom to Next Extent Supported?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-javascript-4-x-zoom-to-previous/m-p/1143717#M76335</link>
      <description>&lt;P&gt;Hello everyone.&amp;nbsp; Working on updating some applications from the JS API 3.x environment to the JS API 4.x environment.&lt;/P&gt;&lt;P&gt;I am looking to add in a button for a Zoom to Previous Extent and a button for Zoom to Next Extent.&amp;nbsp; I am looking at the API reference, but do not find anything.&lt;/P&gt;&lt;P&gt;Is there anything in JS API 4.x that is like this?&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/navigation.html#zoomtonextextent" target="_blank" rel="noopener"&gt;zoomToNextExtent()&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/navigation.html#zoomtoprevextent" target="_blank" rel="noopener"&gt;zoomToPrevExtent()&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I am looking, but not finding anything.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 17:21:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-javascript-4-x-zoom-to-previous/m-p/1143717#M76335</guid>
      <dc:creator>ipeebles</dc:creator>
      <dc:date>2022-02-14T17:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS API for JavaScript 4.x - Zoom to Previous Extent and Zoom to Next Extent Supported?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-javascript-4-x-zoom-to-previous/m-p/1143749#M76336</link>
      <description>&lt;P&gt;I don't know if there will ever be the same functions as in 3.X, but I implemented the same (at least the previous extents) using a little code.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Add a variable somewhere before it all happens
let prevPoint = [];

// You probably already have a 'view.when' section, add the 'view.watch' to
//  look for changes to the extent and store those in the prevPoint list.
view.when(function () {
	// Setup listener for the extent change, then populate the previous point using its center
	view.watch("extent", function (newValue, oldValue) {
		let dTest = Math.abs(newValue.xmax - newValue.xmin);
		let dFactor = dTest / 100;  // Need to leave any small movements behind, but these depend on scale.
		if (Math.abs(newValue.xmax - oldValue.xmax) &amp;gt; dFactor ||
			Math.abs(newValue.xmin - oldValue.xmin) &amp;gt; dFactor ||
			Math.abs(newValue.ymax - oldValue.ymax) &amp;gt; dFactor ||
			Math.abs(newValue.ymin - oldValue.ymin) &amp;gt; dFactor) {
			prevPoint.push(newValue);
		}
		if (prevPoint.length &amp;gt; 40) { prevPoint.shift(); //stored }
	});
});

// Previous button functionality (zoom to previous)
let btnPrevExtent = dom.byId("btnPrevExtent");
on(btnPrevExtent, "click", function () {
	zoomPrevious();
})

function zoomPrevious() {
	if (prevPoint.length &amp;gt; 1) {
		prevPoint.pop();
		let lastEx = prevPoint[prevPoint.length - 1];
		prevPoint.pop();
		view.extent = lastEx;
	}
}&lt;/LI-CODE&gt;&lt;P&gt;Could probably be made more concise but you get the idea.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 18:11:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-javascript-4-x-zoom-to-previous/m-p/1143749#M76336</guid>
      <dc:creator>JeffreyWilkerson</dc:creator>
      <dc:date>2022-02-14T18:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS API for JavaScript 4.x - Zoom to Previous Extent and Zoom to Next Extent Supported?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-javascript-4-x-zoom-to-previous/m-p/1143763#M76338</link>
      <description>&lt;P&gt;Yeah, these methods will most likely not be implemented in 4x.&lt;/P&gt;&lt;P&gt;If I were to change one thing, is save the extent on watchUtils.whenFalse(view, "updating", method)&lt;/P&gt;&lt;P&gt;This way you don't need to check for the small extent changes. You can also utilize the spatialReference.equals(sr) method to make sure they are different&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-SpatialReference.html#equals" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-SpatialReference.html#equals&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This is clever, though, nice work&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 18:48:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-javascript-4-x-zoom-to-previous/m-p/1143763#M76338</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-02-14T18:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS API for JavaScript 4.x - Zoom to Previous Extent and Zoom to Next Extent Supported?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-javascript-4-x-zoom-to-previous/m-p/1143777#M76339</link>
      <description>&lt;P&gt;Thank you for the response.&amp;nbsp; I was hoping most functionality would carry over.&amp;nbsp; Never easy telling those who use apps that certain functionality is no longer available.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 19:12:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-javascript-4-x-zoom-to-previous/m-p/1143777#M76339</guid>
      <dc:creator>ipeebles</dc:creator>
      <dc:date>2022-02-14T19:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS API for JavaScript 4.x - Zoom to Previous Extent and Zoom to Next Extent Supported?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-javascript-4-x-zoom-to-previous/m-p/1143785#M76341</link>
      <description>&lt;P&gt;This thread may also interest you. in 3.x there was a navigation toolbar and in this link I have a sample that creates the navigation toolbar in 4.x (which includes prev and next view extents)&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-api-for-javascript-questions/does-the-class-quot-esri-toolbars-navigation-quot/m-p/567061" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/arcgis-api-for-javascript-questions/does-the-class-quot-esri-toolbars-navigation-quot/m-p/567061&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 13:42:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-javascript-4-x-zoom-to-previous/m-p/1143785#M76341</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2022-02-15T13:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS API for JavaScript 4.x - Zoom to Previous Extent and Zoom to Next Extent Supported?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-javascript-4-x-zoom-to-previous/m-p/1143786#M76342</link>
      <description>&lt;P&gt;Yeah, just remember it was all built with Javascript so eventually you should be able to figure out how to do something similar.&amp;nbsp; Just classes, functions, methods, and events.&amp;nbsp; Always nice to have someone of Rene's caliber to chime in when your a little off but bet you would have been able to get close to what I did.&amp;nbsp; Now you can also include a next by not popping the extent off and losing it after each previous.&amp;nbsp; Not sure what that will be but make sure to post it once you get it finished.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 19:27:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-javascript-4-x-zoom-to-previous/m-p/1143786#M76342</guid>
      <dc:creator>JeffreyWilkerson</dc:creator>
      <dc:date>2022-02-14T19:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS API for JavaScript 4.x - Zoom to Previous Extent and Zoom to Next Extent Supported?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-javascript-4-x-zoom-to-previous/m-p/1144018#M76353</link>
      <description>&lt;P&gt;Thank you Robert!&amp;nbsp; I will certainly have a look.&amp;nbsp; This looks great!&amp;nbsp; I am having a discussion with my colleague to see if we want to include the zoom to previous and next extent.&amp;nbsp; We may exclude for now, but I will certainly have a look at your sample.&amp;nbsp; Your input is always appreciated.&amp;nbsp; Hoping to speak with you at the Dev Summit again, but we are not traveling right now.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 13:21:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-javascript-4-x-zoom-to-previous/m-p/1144018#M76353</guid>
      <dc:creator>ipeebles</dc:creator>
      <dc:date>2022-02-15T13:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS API for JavaScript 4.x - Zoom to Previous Extent and Zoom to Next Extent Supported?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-javascript-4-x-zoom-to-previous/m-p/1144019#M76354</link>
      <description>&lt;P&gt;Just wanted to thank everyone for responding.&amp;nbsp; Truly appreciate your feedback.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 13:22:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-javascript-4-x-zoom-to-previous/m-p/1144019#M76354</guid>
      <dc:creator>ipeebles</dc:creator>
      <dc:date>2022-02-15T13:22:22Z</dc:date>
    </item>
  </channel>
</rss>

