AnsweredAssumed Answered

4.x hitTest issue

Question asked by JLuymes on Mar 22, 2018
Latest reply on Mar 23, 2018 by JLuymes

Getting a weird error every once in a while for a hitTest function (still using 4.4 to avoid another bug but it happens in 4.6 as well).

 

EDIT: confirmed in Esri samples this a bug with the hitTest function. This seems to be fixed if i test in 4.7.

 

    view.then(() => {
      view.whenLayerView(nbhdLyr).then(function(lview2){
        watchUtils.whenFalse(lview2,"updating",function(){
          view.on("pointer-move",eventHandler2);
          function eventHandler2(event) {
            view.hitTest(event).then(getGraphics2);
          }
        });
      });
    });

 

It then passes to a function that sends attributes to a popup

 

    function getGraphics2(response2) {
      if (response2.results.length) {
        var graphic = response2.results.filter(function(result2) {
          return result2.graphic.layer === nbhdLyr;
        })[0].graphic;
        var attributes = graphic.attributes;
        var nbdattr = attributes.NEIGHBOURHOOD;
        var poattr = attributes.PREORDERS;
        var cusattr = attributes.CUSTOMERS;
        var intattr = attributes.INTERESTLEVEL;
        var mrkattr = attributes.MARKETPEN;
        var addrattr = attributes.PROPERTIES;
        var pconvattr = attributes.POCONV;
        document.getElementById("info").style.visibility = "visible";
        document.getElementById("nbhd").innerHTML = nbdattr;
        document.getElementById("preorders").innerHTML = " <b>" + poattr + "</b> preorders";
        document.getElementById("customers").innerHTML = " <b>" + cusattr + "</b> customers";
        document.getElementById("interest").innerHTML = " <b>" + intattr + "%</b> total interest";
        document.getElementById("marketpen").innerHTML = " <b>" + mrkattr + "%</b> market penetration";
        document.getElementById("address").innerHTML = " <b>" + addrattr + "</b> addresses";
        document.getElementById("poconv").innerHTML = " <b>" + pconvattr + "%</b> preorders converted";
      }
    }

 

This will sometimes give an error on the hitTest function, saying:

Uncaught TypeError: Failed to execute 'elementFromPoint' on 'Document': The provided double value is non-finite.

 

Image is also attached. I'm not sure what's causing this or how to get around it, anyone see this issue or have any thoughts?

Attachments

Outcomes