我有一个可编辑的多边形,我想听一个顶点被拖动时的事件(调整多边形的大小)。通常将路径附加到'set_at'事件是好的,但是当整个多边形被拖动时,它会引发很多事件。
google.maps.event.addListener(polygon, 'dragend', function(){search();});
google.maps.event.addListener(polygon.getPath(), 'insert_at', function(e, e1){search();});
google.maps.event.addListener(polygon.getPath(), 'remove_at', function(e, e1){search();});
//this also fires a lot of events when ploygon is dragged
google.maps.event.addListener(polygon.getPath(), 'set_at', function(){search();});
我要实现的是有一个类似“shape_changed”的事件,它在拖动时不会触发事件。
最佳答案
删除set_at
上的dragstart
-listener并重新分配set_at
上的dragend
-listener
关于javascript - set_at事件中的Google Map可编辑多边形过滤器拖动事件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19714456/