dbecker88

onMouseOver & onMouseOut

Discussion created by dbecker88 on Jul 19, 2012
Latest reply on Aug 2, 2012 by dbecker88
feature layer is added to map. I would like to hover and get basic info, then click and execute onClick identify task.
the hover works great, the popup is displayed and the graphic is cleared onMouseOut, but as soon as the onClick is fired, it immmediately gets replaced by the basic onMouseOver popup.

Im assuming this is becasue my hand isn't steady, onMouseOver -- basic popup, onClick --detailed popup, slight movement onMouseOver --basic popup.

any help?

function init() {

    featlayer = new esri.layers.FeatureLayer("url",{
            mode:esri.layers.FeatureLayer.MODE_ONDEMAND,
      //infoTemplate:template,
      id: 'facs',      
            outFields:["*"]
          });
    dojo.connect(featlayer, "onMouseOver", showHoverPopup);
    dojo.connect(featlayer, "onMouseOut", hideHoverPopup);
    dojo.connect(map,"onClick",executeIdentifyTask);
}

    function showHoverPopup(evt){
   map.graphics.enableMouseEvents();
   var infoTemplate = new esri.InfoTemplate();
   infoTemplate.setTitle(evt.graphic.attributes.facil_name);
   infoTemplate.setContent("<b>${facil_name}</b>");
   map.infoWindow.resize(245,125);
   
   var highlightSym = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10,
    new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
    new dojo.Color([255,0,0]), 1),
    new dojo.Color([0,255,0,0.25]));
   
   evt.graphic.setInfoTemplate(infoTemplate);
   
   var content = evt.graphic.getContent();
   map.infoWindow.setContent(content);
   var title = evt.graphic.getTitle();
   map.infoWindow.setTitle(title);
   highlightGraphic = new esri.Graphic(evt.graphic.geometry,highlightSym);
   map.graphics.add(highlightGraphic);
   map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint));
   
   }
  
function hideHoverPopup(evt){
 map.graphics.remove(highlightGraphic);
}

Outcomes