<?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 Re: Does the class &amp;quot;esri/toolbars/navigation&amp;quot; exist in ArcGis Javascript 4x in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-the-class-quot-esri-toolbars-navigation-quot/m-p/567063#M52923</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for helping me out once again. I really appreciate it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Jan 2019 01:08:08 GMT</pubDate>
    <dc:creator>bobongubza</dc:creator>
    <dc:date>2019-01-23T01:08:08Z</dc:date>
    <item>
      <title>Does the class "esri/toolbars/navigation" exist in ArcGis Javascript 4x</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-the-class-quot-esri-toolbars-navigation-quot/m-p/567061#M52921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to migrate code from ArcGis Javascript 3x to 4x. I have noticed "esri/toolbars/navigation"&amp;nbsp; is not on&amp;nbsp;&lt;SPAN&gt;ArcGis Javascript 4x.&amp;nbsp; I want recreate the navigation toolbars on&amp;nbsp;ArcGis Javascript 4x, simliar to the one on this link&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/3/sandbox/sandbox.html?sample=toolbar_navigation" title="https://developers.arcgis.com/javascript/3/sandbox/sandbox.html?sample=toolbar_navigation"&gt;ArcGIS API for JavaScript Sandbox&lt;/A&gt;&amp;nbsp;(from&amp;nbsp;ArcGis Javascript 3x)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My question is where can I locate&amp;nbsp;a class similar to it on&amp;nbsp;ArcGis Javascript 4x.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2019 11:04:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-the-class-quot-esri-toolbars-navigation-quot/m-p/567061#M52921</guid>
      <dc:creator>bobongubza</dc:creator>
      <dc:date>2019-01-22T11:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Does the class "esri/toolbars/navigation" exist in ArcGis Javascript 4x</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-the-class-quot-esri-toolbars-navigation-quot/m-p/567062#M52922</link>
      <description>&lt;P&gt;Bobo,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;The 4.x API does NOT have a navigation toolbar like the 3.x API does yet. So I created this app that replicates the 3.x navigation toolbar.&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;meta charset="utf-8"&amp;gt;
  &amp;lt;meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"&amp;gt;
  &amp;lt;title&amp;gt;Navigation Toolbar - 4.10&amp;lt;/title&amp;gt;
  &amp;lt;style&amp;gt;
    html,
    body,
    #viewDiv {
      padding: 0;
      margin: 0;
      height: 100%;
      width: 100%;
    }

    #tools {
      padding: 1em;
      text-align: center;
    }

    .tool {
      padding-top: 3px;
      padding: 4px 2px;
    }

    .tool.disabled,
    .tool.disabled:hover {
      opacity: 0.6;
      pointer-events: none;
    }

    .tool:hover,
    .tool.selected:hover {
      background-color: rgba(0, 0, 0, 0.5);
    }

    .tool.selected {
      background-color: rgba(0, 0, 0, 0.3);
    }
  &amp;lt;/style&amp;gt;

  &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.10/esri/css/main.css"&amp;gt;
  &amp;lt;script src="https://js.arcgis.com/4.10/"&amp;gt;&amp;lt;/script&amp;gt;

  &amp;lt;script&amp;gt;
    var _prevExtent, _preExtent,
    _currentvExtent, _extentHistory,
    evtViewDragHandler, evtViewKeyDownHandler, draw,
    fullExtent
    require([
      "esri/Map",
      "esri/views/MapView",
      "esri/core/watchUtils",
      "dojo/dom-class",
      "dojo/dom",
      "dojo/on",
      "esri/views/2d/draw/Draw",
      "esri/geometry/Extent",
      "esri/Graphic"
    ], function(Map, MapView, watchUtils, domClass, dom, on, Draw, Extent, Graphic) {
      _prevExtent = false;
      _preExtent = null;
      _currentExtent = null;
      _extentHistory = [];
      _extentHistoryIndx = 0;
      _nextExtent = false;
      var map = new Map({
        basemap: "streets"
      });

      var view = new MapView({
        container: "viewDiv",
        map: map,
        zoom: 4,
        center: [15, 65] // longitude, latitude
      });

      watchUtils.whenTrue(view, "ready", function(){
        fullExtent = view.extent.clone();
        draw = new Draw({
          view: view
        });
        initToolbar();
        watchUtils.whenOnce(view, "extent", function(){
          watchUtils.when(view, 'stationary', function(evt){
            if(evt){
              extentChangeHandler(view.extent);
            }
          });
        });
      });

      function extentChangeHandler(evt) {
        if(_prevExtent || _nextExtent){
          _currentExtent = evt;
        }else{
          _preExtent = _currentExtent;
          _currentExtent = evt;
          _extentHistory.push({
            preExtent: _preExtent,
            currentExtent: _currentExtent
          });
          _extentHistoryIndx = _extentHistory.length - 1;
        }
        _prevExtent = _nextExtent = false;
        extentHistoryChange();
      }

      function extentHistoryChange() {
        if(_extentHistory.length === 0 || _extentHistoryIndx === 0 ){
          domClass.add(dom.byId("zoomprev"), "disabled");
        } else {
          domClass.remove(dom.byId("zoomprev"), "disabled");
        }
        if(_extentHistory.length === 0 || _extentHistoryIndx === _extentHistory.length - 1){
          domClass.add(dom.byId("zoomnext"), "disabled");
        } else {
          domClass.remove(dom.byId("zoomnext"), "disabled");
        }
      }

      function enableViewPanning() {
        if(evtViewDragHandler){
          evtViewDragHandler.remove();
          evtViewDragHandler = null;
        }
        if(evtViewKeyDownHandler){
          evtViewKeyDownHandler.remove();
          evtViewKeyDownHandler = null;
        }
      }

      function disableViewPanning() {
        if(evtViewDragHandler){
          evtViewDragHandler.remove();
          evtViewDragHandler = null;
        }
        if(evtViewKeyDownHandler){
          evtViewKeyDownHandler.remove();
          evtViewKeyDownHandler = null;
        }
        evtViewDragHandler = view.on("drag", function(event) {
          // prevents panning with the mouse drag event
          event.stopPropagation();
        });

        evtViewKeyDownHandler = view.on("key-down", function(event) {
          // prevents panning with the arrow keys
          var keyPressed = event.key;
          if (keyPressed.slice(0, 5) === "Arrow") {
            event.stopPropagation();
          }
        });
      }

      function displayCrosshairCursor() {
        this.view &amp;amp;&amp;amp; this.view.container &amp;amp;&amp;amp; this.view.container.style &amp;amp;&amp;amp; "crosshair" !== this.view.container.style.cursor &amp;amp;&amp;amp; (this.view.container.style.cursor = "crosshair")
      }
      function displayPointerCursor() {
        this.view &amp;amp;&amp;amp; this.view.container &amp;amp;&amp;amp; this.view.container.style &amp;amp;&amp;amp; "pointer" !== this.view.container.style.cursor &amp;amp;&amp;amp; (this.view.container.style.cursor = "pointer")
      }
      function displayDefaultCursor() {
        this.view &amp;amp;&amp;amp; this.view.container &amp;amp;&amp;amp; this.view.container.style &amp;amp;&amp;amp; "default" !== this.view.container.style.cursor &amp;amp;&amp;amp; (this.view.container.style.cursor = "default")
      }

      function removeCurrentSelTool() {
        view.popup.close();
        domClass.remove(dom.byId("panmap"), "selected");
        domClass.remove(dom.byId("zoomin"), "selected");
        domClass.remove(dom.byId("zoomout"), "selected");
      }

      function drawRect(event){
        var vertices = event.vertices;
        //remove existing graphic
        view.graphics.removeAll();
        if(vertices.length &amp;lt; 2){
          return;
        }

        // create a new extent
        var extent = getExtentfromVertices(vertices);

        var graphic = new Graphic({
          geometry: extent,
          symbol: {
            type: "simple-fill", // autocasts as SimpleFillSymbol
            color: [0, 0, 0, 0.3],
            style: "solid",
            outline: { // autocasts as SimpleLineSymbol
              color: [255, 0, 0],
              width: 1
            }
          }
        });

        view.graphics.add(graphic);
      }

      function zoomIn(evt){
        draw.reset();
        view.graphics.removeAll();
        var action = draw.create("rectangle");
        view.focus();
        action.on("vertex-add", drawRect);
        action.on("draw-complete", zoomIn);
        action.on("cursor-update", drawRect);
        if(evt.vertices.length === 1){
          view.goTo({scale: (view.scale * .5)});
          return;
        }
        var extent = getExtentfromVertices(evt.vertices);
        if (extent.width !== 0 || extent.height !== 0){
          view.goTo(extent);
        }
      }

      function zoomOut(evt){
        var vertices = evt.vertices;
        draw.reset();
        view.graphics.removeAll();
        var action = draw.create("rectangle");
        view.focus();
        action.on("vertex-add", drawRect);
        action.on("draw-complete", zoomOut);
        action.on("cursor-update", drawRect);
        if(evt.vertices.length === 1){
          view.goTo({scale: (view.scale * 2)});
          return;
        }
        var sx = vertices[0][0], sy = vertices[0][1];
        var ex = vertices[1][0], ey = vertices[1][1];
        var rect = {
          x: Math.min(sx, ex),
          y: Math.max(sy, ey),
          width: Math.abs(sx - ex),
          height: Math.abs(sy - ey),
          spatialReference: view.spatialReference
        };
        if (rect.width !== 0 || rect.height !== 0){
          var scrPnt1 = view.toScreen(rect);
          var scrPnt2 = view.toScreen({x: rect.x + rect.width, y: rect.y, spatialReference: rect.spatialReference});
          var mWidth = view.extent.width;
          var delta = (mWidth * view.width / Math.abs(scrPnt2.x - scrPnt1.x) - mWidth) / 2;
          var vExtent = view.extent;
          view.goTo(new Extent({
            xmin: vExtent.xmin - delta,
            ymin: vExtent.ymin - delta,
            xmax: vExtent.xmax + delta,
            ymax: vExtent.ymax + delta,
            spatialReference: vExtent.spatialReference
          }));
        }
      }

      function getExtentfromVertices(vertices){
        var sx = vertices[0][0], sy = vertices[0][1];
        var ex = vertices[1][0], ey = vertices[1][1];
        var rect = {
          x: Math.min(sx, ex),
          y: Math.max(sy, ey),
          width: Math.abs(sx - ex),
          height: Math.abs(sy - ey),
          spatialReference: view.spatialReference
        };
        if (rect.width !== 0 || rect.height !== 0){
          return new Extent({
            xmin: parseFloat(rect.x),
            ymin: parseFloat(rect.y) - parseFloat(rect.height),
            xmax: parseFloat(rect.x) + parseFloat(rect.width),
            ymax: parseFloat(rect.y),
            spatialReference: rect.spatialReference
          });
        }else{
          return null;
        }
      }

      function initToolbar() {
        on(dom.byId("zoomfull"), "click", function() {
          view.goTo( fullExtent);
        });
        on(dom.byId("zoomnext"), "click", function() {
          _nextExtent = true;
          _extentHistoryIndx++;
          view.goTo(_extentHistory[_extentHistoryIndx].currentExtent);
        });
        on(dom.byId("zoomprev"), "click", function() {
          if(_extentHistory[_extentHistoryIndx].preExtent){
            _prevExtent = true;
            view.goTo(_extentHistory[_extentHistoryIndx].preExtent);
            _extentHistoryIndx--;
          }
        });
        on(dom.byId("zoomin"), "click", function() {
          removeCurrentSelTool();
          disableViewPanning();
          view.graphics.removeAll();
          var action = draw.create("rectangle");
          displayCrosshairCursor();
          view.focus();
          action.on("vertex-add", drawRect);
          action.on("draw-complete", zoomIn);
          action.on("cursor-update", drawRect);
          domClass.add(dom.byId("zoomin"), "selected");
        });
        on(dom.byId("zoomout"), "click", function() {
          removeCurrentSelTool();
          disableViewPanning();
          view.graphics.removeAll();
          var action = draw.create("rectangle");
          displayCrosshairCursor();
          view.focus();
          action.on("vertex-add", drawRect);
          action.on("draw-complete", zoomOut);
          action.on("cursor-update", drawRect);
          domClass.add(dom.byId("zoomout"), "selected");
        });
        on(dom.byId("panmap"), "click", function() {
          removeCurrentSelTool();
          enableViewPanning();
          displayDefaultCursor();
          draw.reset();
          domClass.add(dom.byId("panmap"), "selected");
        });
      }
      view.ui.add("tools", "top-right");
    });
  &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
  &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;div id="tools" class="esri-widget"&amp;gt;
    &amp;lt;img src="images/esriZoomIn.png" alt="Zoom In" title="Zoom In" class="tool" id="zoomin" /&amp;gt;
    &amp;lt;img src="images/esriZoomOut.png" alt="Zoom Out" title="Zoom Out" class="tool" id="zoomout" /&amp;gt;
    &amp;lt;img src="images/esriPan.png" alt="Pan Map" title="Pan Map" class="tool selected" id="panmap" /&amp;gt;
    &amp;lt;img src="images/esriZoomFullExtent.png" alt="Full Extent" title="Full Extent" class="tool" id="zoomfull" /&amp;gt;
    &amp;lt;img src="images/backward.png" alt="Back Extent" title="Back Extent" class="tool" id="zoomprev" /&amp;gt;
    &amp;lt;img src="images/forward.png" alt="Forward Extent" title="Forward Extent" class="tool" id="zoomnext" /&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have been neglecting to mark any of your question as answered here on GeoNet. This will lead to less responses in the future.&amp;nbsp;Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 17:05:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-the-class-quot-esri-toolbars-navigation-quot/m-p/567062#M52922</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-08-04T17:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: Does the class "esri/toolbars/navigation" exist in ArcGis Javascript 4x</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-the-class-quot-esri-toolbars-navigation-quot/m-p/567063#M52923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for helping me out once again. I really appreciate it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2019 01:08:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-the-class-quot-esri-toolbars-navigation-quot/m-p/567063#M52923</guid>
      <dc:creator>bobongubza</dc:creator>
      <dc:date>2019-01-23T01:08:08Z</dc:date>
    </item>
  </channel>
</rss>

