coreyalix01

InfoWindow.show + set extent w/out zoom

Discussion created by coreyalix01 on Feb 16, 2011
Latest reply on Feb 16, 2011 by coreyalix01
When I set the extent then show an InfoWindow I get an exception.  The cause of the exception is the map._infoWindowIsShowing === true but the map._infoWindowCoords === null.

This code documents the problem (I introduced the c variable):

        esriMap._infoWindowExtentChangeHandler = function (_513, _514, _515) {
            // avoids failure but too soon for toMap (the window will miss the mark).
            if (this._infoWindowIsShowing) {
                var c = this._infoWindowCoords || // this is null
                     this.toMap(new esri.geometry.Point(this.infoWindow.coords));
                var _516;
                if (_515) {
                    _516 = this.toScreen(c);
                } else {
                    _516 = this.infoWindow.coords.offset(_514.x, _514.y);
                }
                this.infoWindow.show(_516, this.getInfoWindowAnchor(_516), true);
            }
        };

_infoWindowZoomStartHandler is the only place which assigns a value to _infoWindowCoords.  _infoWindowShowHandler sets _infoWindowIsShowing = true.

It's was hard to determine why this condition arose without the ability to step through the source but I *think*:

_infoWindowZoomStartHandler is not connected until the InfoWindow is first shown.  If this happens after the setExtent but before the animation completes, then the onExtentChange fires with a null value in _infoWindowCoords.

A likely workaround is to provide a geographic coordinate instead of screen coordinate but I'm not sure that'll work with offset, if at all. 

Any advice is appreciated.

Outcomes