<?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: Stuck in Pan Mode after long pressing the map in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/stuck-in-pan-mode-after-long-pressing-the-map/m-p/617841#M57743</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The issue is because the map is in navigation mode by default, so when you press down the mouse key, the map responds with PAN operation. What you can do is to disable the map navigation when the user long presses the feature of a feature layer, and enable it once you finish handling the event.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In addition, I would define the onMouseDown event handler against the feature layer instead of the map. Here is the code sample assuming the featureLayer created somewhere else.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var timer, isPan = this.map.isPan;
&amp;nbsp;&amp;nbsp;&amp;nbsp; on(this.featureLayer, "mouse-down", lang.hitch(this, function(e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; timer = setTimeout(lang.hitch(this, function() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; isPan &amp;amp;&amp;amp; this.map.disablePan();

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.selectFeatures(e.screenPoint).then(lang.hitch(this.editor, this.editor.moveFeature));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }), 5*1000);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }));

&amp;nbsp;&amp;nbsp;&amp;nbsp; on(this.featureLayer, "mouse-up", function(e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; clearTimeout(timer);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; isPan &amp;amp;&amp;amp; this.map.enablePan();
&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 02:23:47 GMT</pubDate>
    <dc:creator>JasonZou</dc:creator>
    <dc:date>2021-12-12T02:23:47Z</dc:date>
    <item>
      <title>Stuck in Pan Mode after long pressing the map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/stuck-in-pan-mode-after-long-pressing-the-map/m-p/617840#M57742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is it possible to handle a long press on the map?&amp;nbsp; I am trying to develop an interface where clicking on a feature on the map will open the attribute editor and long pressing on a feature will enable edit mode so the user can move the feature.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have code that should do this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
var timer;
&amp;nbsp;&amp;nbsp;&amp;nbsp; on(this.map, "mouse-down", lang.hitch(this, function(e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; timer = setTimeout(lang.hitch(this, function() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.selectFeatures(e.screenPoint).then(lang.hitch(this.editor, this.editor.moveFeature));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }), 5*1000);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }));

&amp;nbsp;&amp;nbsp;&amp;nbsp; on(this.map, "mouse-up", function(e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; clearTimeout(timer);
&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I long press the map the map somehow goes into pan mode and without clicking the mouse, wherever I move the cursor the map pans with it.&amp;nbsp; In other words, wherever I long pressed on the map will remain under the cursor wherever I move the cursor on the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From what I can tell, my code is also working, but with this additional side effect.&amp;nbsp; The only way I have found to get out of pan mode is to refresh the page.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have seen other posts related to similar behavior of pan mode, but they are all limited to IE.&amp;nbsp; I am seeing this in Chrome.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Sep 2013 15:28:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/stuck-in-pan-mode-after-long-pressing-the-map/m-p/617840#M57742</guid>
      <dc:creator>BrianBeck</dc:creator>
      <dc:date>2013-09-18T15:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: Stuck in Pan Mode after long pressing the map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/stuck-in-pan-mode-after-long-pressing-the-map/m-p/617841#M57743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The issue is because the map is in navigation mode by default, so when you press down the mouse key, the map responds with PAN operation. What you can do is to disable the map navigation when the user long presses the feature of a feature layer, and enable it once you finish handling the event.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In addition, I would define the onMouseDown event handler against the feature layer instead of the map. Here is the code sample assuming the featureLayer created somewhere else.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var timer, isPan = this.map.isPan;
&amp;nbsp;&amp;nbsp;&amp;nbsp; on(this.featureLayer, "mouse-down", lang.hitch(this, function(e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; timer = setTimeout(lang.hitch(this, function() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; isPan &amp;amp;&amp;amp; this.map.disablePan();

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.selectFeatures(e.screenPoint).then(lang.hitch(this.editor, this.editor.moveFeature));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }), 5*1000);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }));

&amp;nbsp;&amp;nbsp;&amp;nbsp; on(this.featureLayer, "mouse-up", function(e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; clearTimeout(timer);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; isPan &amp;amp;&amp;amp; this.map.enablePan();
&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:23:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/stuck-in-pan-mode-after-long-pressing-the-map/m-p/617841#M57743</guid>
      <dc:creator>JasonZou</dc:creator>
      <dc:date>2021-12-12T02:23:47Z</dc:date>
    </item>
  </channel>
</rss>

