监听polygon变化
Polygons are made of Paths which are just MVCArrays (in this case, they're a list of LatLng objects). MVCArrays have three events: insert_at, remove_at, and set_at. We can use those events to detect changes in the points of the Polygon.
There are also drag events for polygons: dragstart, drag, 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
监听polygon变化的更多相关文章
- Angular.js中使用$watch监听模型变化
$watch简单使用 $watch是一个scope函数,用于监听模型变化,当你的模型部分发生变化时它会通知你. $watch(watchExpression, listener, objectEqua ...
- $scope.$watch()——监听数据变化
$scope.$watch(watchFn, watchAction, [deepWatch]):监听数据变化,三个参数 --watchFn:监听的对象,一个带有Angular 表达式或者函数的字符串 ...
- 如何使用NodeJs来监听文件变化
1.前言 在我们调试修改代码的时候,每修改一次代码,哪怕只是很小的修改,我们都需要手动重新build文件,然后再运行代码,看修改的效果,这样的效率特别低,对于开发者来说简直不能忍. 2.构建自动编译工 ...
- android动态注册监听网络变化异常
在使用广播接收器监听网络变化的时候,在AndroidManifest.xml中加入<user-permission android:name="android.permission.A ...
- Android实现后台长期监听时间变化
1.首先我们的目的是长期监听时间变化,事实上应用程序退出. 通过了解我们知道注冊ACTION_TIME_TICK广播接收器能够监听系统事件改变,可是 查看SDK发现ACTION_TIME_TICK广播 ...
- Android 监听网络变化
Android 监听网络变化
- --@angularJS--$scope.watch监听模型变化
$watch简单使用 $watch是一个scope函数,用于监听模型变化,当你的模型部分发生变化时它会通知你. $watch(watchExpression, listener, objectEqua ...
- vue.js之过滤器,自定义指令,自定义键盘信息以及监听数据变化
一.监听数据变化 1.监听数据变化有两种,深度和浅度,形式如下: vm.$watch(name,fnCb); //浅度 vm.$watch(name,fnCb,{deep:true}); //深度监视 ...
- webview缓存及跳转时截取url地址、监听页面变化
缓存及一些设定 我在做一些项目时,h5做的项目手机浏览器能使用,但是在搬到webview时候不能用,这个时候通过查阅资料,原来是webview没有设定好,包括缓存.缓存大小及路径等等 mWebview ...
随机推荐
- iframe详细用法
<iframe>是框架的一种形式,也比较常用到. 例子1.<iframe width=420 height=330 frameborder=0 scrolling=auto src= ...
- Android sqlite数据库存取图片信息
Android sqlite数据库存取图片信息 存储图片:bitmap private byte[] getIconData(Bitmap bitmap){ int size = bitmap.get ...
- bzoj1898
这是yhc大牛矩乘论文上的题目,那里面分析得很清楚了这里就说说我一开始错的地方,我一开始处理每个时刻能通过的邻接矩阵的时候把以不能访问的点i为起点和终点的都标记为0了,实际上只能标记以i为终点的边即可 ...
- 一起啃PRML - 1 Introduction 绪论
一起啃PRML - 1 Introduction @copyright 转载请注明出处 http://www.cnblogs.com/chxer/ 这一部分主要是介绍一下Pattern Recogni ...
- SolrCloud应用简介
1.windows下启动实例工程 官网下载solr后解压到本地硬盘,在sol/bin目录下打开命令行窗口,然后测试以下命令: solr -e cloud 启动例子中的solrcould,进入交互界面, ...
- Robot Framework安装
Robot Framework(中文站/社交化知识社区,源码)是一款Python编写的通用开源功能测试自动化框架,以作验收测试和验收测试驱动开发(ATDD),它是一种使用表格测试数据语法的关键字驱动的 ...
- TortoiseSVN优化设置
设置log messages的字体 TortoiseSVN默认的字体太小了,看着难受: 可以在Settings > 左侧目录树General > Dialogs 1中进行设置: 使用Bey ...
- 关于如何导入GPUImage
今天是我第一天做项目哈,由于前几天实在是没有很多空,我姐结婚,事情太多,所以今天才开始真正写项目,希望不要太晚. 今天是晚上开始的,预期的计划就是能够把GPUImage成功导入,然后使用一些其中的东西 ...
- zabbix 编译
yum -y install xml* libxml* net-snmp net-snmp* php-bcmath ./configure --enable-server --enable-agent ...
- 转 jquery 学习笔记
jQ通过选择器选择元素,选择器的语法和css类似$(css选择器语法) 参数可以是id.class.tag等等通过如上选择就可以获得一个元素 jQuery名字冲突 解决方法: var jq=jQuer ...