【发布时间】:2015-01-08 18:38:17
【问题描述】:
我正在尝试使用Angular Google Maps 模块在谷歌地图上显示多边形,但是当模型的可见属性被修改时,uiGmapPolygons 指令没有隐藏/显示。
这里有一个 plunker 来说明这个问题: http://plnkr.co/edit/EhFihJRBK9Lb0s3mwMSl
标记:
<ui-gmap-google-map center="map.center" zoom="map.zoom" draggable="true" options="options" bounds="map.bounds">
<ui-gmap-polygons models="polygons" path="'path'" stroke="'stroke'" visible="'visible'" fill="{ color: '#2c8aa7', opacity: '0.3' }">
</ui-gmap-polygons>
<ui-gmap-markers models="markers" idKey="'id'" options="'options'" coords="'coords'"></ui-gmap-markers>
</ui-gmap-google-map>
角度代码:
$scope.polygons = [{
id: 1,
path: [{
latitude: 50,
longitude: -80
}, {
latitude: 30,
longitude: -120
}, {
latitude: 20,
longitude: -95
}],
stroke: {
color: '#6060FB',
weight: 3
},
editable: true,
draggable: true,
geodesic: false,
visible: true,
fill: {
color: '#ff0000',
opacity: 0.8
}
}];
$scope.toggle = function() {
$scope.polygons[0].visible = !$scope.polygons[0].visible;
$scope.markers[0].options.visible = !$scope.markers[0].options.visible;
};
我希望当我更改多边形将显示/隐藏的可见属性时。
我不确定我是否发现了错误,或者我是否试图错误地调整多边形的可见性。
编辑:
几天前我在模块的 github repo 上提交了一个问题,昨晚得到了回复,解决了 2.0.11 版本中的问题。不幸的是,我使用的是 2.0.12 版本。
关于该问题的 github 讨论链接:
https://github.com/angular-ui/angular-google-maps/issues/1059
【问题讨论】:
-
有同样的问题。你有什么发现吗?
-
我前几天在github上提交了一个issue,昨天刚收到回复。评论者找到了可能的解决方案,但似乎无法解决 2.0.12 版本中的问题。 Issue 1059
标签: angularjs google-maps-api-3 angular-google-maps