我有一张地图和几个听众,
一个点击监听器,用于绘制多边形线和一个鼠标移动监听器的点,以跟随(引导)用户到下一个点,但问题是当PolyLine
直接位于光标下方时阻止了来自接收click
听众的地图。
我不确定这是伟大的设计/执行还是Google地图的边缘情况。
无论光标下方的多边形是什么,我都可以获得点击吗?
// Listen for mouse stuff.
google.maps.event.addListener($scope.googleMapsInstance, 'click', function($event) {
// Do something different at each stage
switch (MyService.currentStage) {
case MyService.stages.IDLE:
// Abort any previous attempts.
if (guide instanceof guideDrawing) {
guide.abort();
guide = null;
}
// Begin drawing poly line.
guide = new guideDrawing($event.latLng);
// Update the current stage.
MyService.currentStage = MyService.stages.APEX_GUIDE_START;
break;
case MyService.stages.GUIDE_START:
// Update the stage
MyService.currentStage = MyService.stages.GUIDE_END;
// Send the new coordinates
guide.finish($event.latLng);
break;
}
});
// Update the poly line with the mouse.
google.maps.event.addListener($scope.googleMapsInstance, 'mousemove', function($event) {
// If we haven't started, just exit;
if (!guide || MyService.currentStage !== MyService.stages.GUIDE_START) {
return;
}
// Send the new coordinates
guide.update($event.latLng);
// Draw the polyline.
guide.draw($scope.googleMapsInstance);
});