<?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: remove highlight flashes on hover in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/remove-highlight-flashes-on-hover/m-p/1242710#M79684</link>
    <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;This sample&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=view-hittest" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=view-hittest&lt;/A&gt;&amp;nbsp;shows you how to do this. Namely take a look at the getGraphics function where we are checking if the some attributes of the graphic returned from hottest matches the attributes of the already highlighted graphic like so:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const graphic = response.results[0].graphic;

const attributes = graphic.attributes;
const category = attributes.CAT;
const wind = attributes.WIND_KTS;
const name = attributes.NAME;
const year = attributes.YEAR;
const id = attributes.OBJECTID;

if (highlight &amp;amp;&amp;amp; (currentName !== name || currentYear !== year)) {
  highlight.remove();
  highlight = null;
  return;
}

if (highlight) {
  return;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Dec 2022 16:04:12 GMT</pubDate>
    <dc:creator>UndralBatsukh</dc:creator>
    <dc:date>2022-12-20T16:04:12Z</dc:date>
    <item>
      <title>remove highlight flashes on hover</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/remove-highlight-flashes-on-hover/m-p/1242667#M79682</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to know how to check if a feature is already highlighted.&lt;/P&gt;&lt;P&gt;I added a highlight for features on mousehover. But the highlight keeps flashing off and on if you move the mouse within a feature.&lt;/P&gt;&lt;P&gt;I think this is because I remove the highlight on every mouse move, without checking if a feature is already highlighted first. I've tried to build in a check for this, but it doesn't work yet. Which is why I'd like to know how to check for this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be much appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code (V4.24):&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;		view.when(() =&amp;gt; {
			let highlight = null;

			view.on("pointer-move", evt =&amp;gt; {
				view.hitTest(evt).then(response =&amp;gt; {
					if (response.results.length &amp;gt; 0) {

						if (highlight) {
							highlight.remove();
						}

						let graphic = response.results[0].graphic;
						view.whenLayerView(graphic.layer).then(function(layerView){
							highlight = layerView.highlight(graphic);
						});

					}
					else{
						if (highlight) {
							highlight.remove();
						}

					}
				});
			});
		});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 14:11:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/remove-highlight-flashes-on-hover/m-p/1242667#M79682</guid>
      <dc:creator>LeidavanHees</dc:creator>
      <dc:date>2022-12-20T14:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: remove highlight flashes on hover</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/remove-highlight-flashes-on-hover/m-p/1242710#M79684</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;This sample&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=view-hittest" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=view-hittest&lt;/A&gt;&amp;nbsp;shows you how to do this. Namely take a look at the getGraphics function where we are checking if the some attributes of the graphic returned from hottest matches the attributes of the already highlighted graphic like so:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const graphic = response.results[0].graphic;

const attributes = graphic.attributes;
const category = attributes.CAT;
const wind = attributes.WIND_KTS;
const name = attributes.NAME;
const year = attributes.YEAR;
const id = attributes.OBJECTID;

if (highlight &amp;amp;&amp;amp; (currentName !== name || currentYear !== year)) {
  highlight.remove();
  highlight = null;
  return;
}

if (highlight) {
  return;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 16:04:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/remove-highlight-flashes-on-hover/m-p/1242710#M79684</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2022-12-20T16:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: remove highlight flashes on hover</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/remove-highlight-flashes-on-hover/m-p/1242893#M79691</link>
      <description>&lt;P&gt;Thank you! I thought I couldn't use this because I have different layers with different attributes. But I looked at it again and am now using the OBJECTID, which works like a charm.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 08:53:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/remove-highlight-flashes-on-hover/m-p/1242893#M79691</guid>
      <dc:creator>LeidavanHees</dc:creator>
      <dc:date>2022-12-21T08:53:09Z</dc:date>
    </item>
  </channel>
</rss>

