문제

I'm trying to open a balloon of a geopoint which is not shown. The official api docs says

if the point is show then open it or it's cluster balloon

but how do I open it if it's not shown? I tried to scroll the map to it's position and then open it, but I'm still getting an error TypeError: this._Hh.getMap(...) is null when opening the balloon.

function bymShowPoint(pId)
{

    var point = bymGetPoint(pId);
    var pState = bymClusterer.getObjectState(point);

    if (!pState.isShown)
    {

        bymScrollToPoint(pId);

    }

    if (pState.isClustered)
    {

        pState.cluster.state.set('activeObject',point);
        pState.cluster.balloon.open();

    }

    else
    {

        point.balloon.open();

    }

}
도움이 되었습니까?

해결책

The API doesn't let you to open a non-visible point's balloon if the point is in a cluster. The way I've solved it (with the help of the yandex community) is:

  1. open the map's balloon at the point's position with the point's data
  2. remove the point from the clusterer (to hide the icon)
  3. on the map's event balloonclose add the removed point to the clusterer
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top