drawManager.setDrawingMode(null) 导致太多递归

sab*_*aba 4 jquery google-maps-api-3

请查看这个小提琴,http://jsfiddle.net/HoffZ/Zu55b/

为什么它会导致错误“递归过多” drawMan.setDrawingMode(null)

drawMan.setDrawingMode(google.maps.drawing.OverlayType.POLYGON);

google.maps.event.addListener(drawMan, 'overlaycomplete', function (event) {
    // When draw mode is set to null you can edit the polygon you just drawed
    drawMan.setDrawingMode(null);
});
Run Code Online (Sandbox Code Playgroud)

这不是我的小提琴,但我的代码中有这个确切的问题

MrU*_*own 5

我必须承认,我不太明白为什么会发生这种情况。

但以下代码似乎有效:

google.maps.event.addListener(drawMan, 'overlaycomplete', function (event) {

    if (drawMan.getDrawingMode()) {

        drawMan.setDrawingMode(null);
    }        
});
Run Code Online (Sandbox Code Playgroud)