博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
监听polygon变化
阅读量:6432 次
发布时间:2019-06-23

本文共 1099 字,大约阅读时间需要 3 分钟。

 are made of Paths which are just  (in this case, they're a list of LatLng objects). MVCArrays have three events: insert_atremove_at, and set_at. We can use those events to detect changes in the points of the Polygon.

There are also : dragstartdrag, and dragend. It's best to listen for dragend if you want to know that a shape was just dragged.

All together, we can detect any changes to a polygon:

// Loop through all paths in the polygon and add listeners// to them. If we just used `getPath()` then we wouldn't // detect all changes to shapes like donuts. polygon.getPaths().forEach(function(path, index){ google.maps.event.addListener(path, 'insert_at', function(){ // New point }); google.maps.event.addListener(path, 'remove_at', function(){ // Point was removed }); google.maps.event.addListener(path, 'set_at', function(){ // Point was moved }); }); google.maps.event.addListener(polygon, 'dragend', function(){ // Polygon was dragged }); 原文:http://stackoverflow.com/questions/20789385/how-can-i-detect-when-an-editable-polygon-is-modified

转载于:https://www.cnblogs.com/qyhol/p/5604304.html

你可能感兴趣的文章
interlib在tomcat7.0的安装
查看>>
水晶报表在大型WEB内部管理系统里的滑铁卢
查看>>
我的友情链接
查看>>
Git学习
查看>>
trove 基于 centos7 制作 mysql5.6 镜像
查看>>
结合i节点和数据块分析linux中软链接和硬链接的区别
查看>>
Heartbeat crm的配置
查看>>
Stream
查看>>
我的友情链接
查看>>
Windows Server 2012_Install_Guide
查看>>
ISA Server搭建站点对站点×××
查看>>
我的友情链接
查看>>
超大规模数据中心:给我一个用整机柜的理由先
查看>>
执行命令取出linux中eth0的IP地址
查看>>
CRUD全栈式编程架构之控制器的设计
查看>>
python常用内建模块(五)
查看>>
你为什么有那么多时间写博客?
查看>>
Excel 中使用VBA
查看>>
$.ajax同步请求会阻塞js进程
查看>>
Postman 网络调试工具
查看>>