Model view controller 使用';标题u已更改';关于MVCArray
怎么会呢,我正在努力解决如何更改下面的代码来处理“Heading_change”而不是“Click”。有人做到了吗?即使没有鼠标点击,它仍然是(事件)吗Model view controller 使用';标题u已更改';关于MVCArray,model-view-controller,google-maps-api-3,Model View Controller,Google Maps Api 3,怎么会呢,我正在努力解决如何更改下面的代码来处理“Heading_change”而不是“Click”。有人做到了吗?即使没有鼠标点击,它仍然是(事件)吗 google.maps.event.addListener(map, 'click', addLatLng); /** * Handles click (or other) events on a map, and adds a new point to the Polyline. * @param {MouseEvent} mouseE
google.maps.event.addListener(map, 'click', addLatLng);
/**
* Handles click (or other) events on a map, and adds a new point to the Polyline.
* @param {MouseEvent} mouseEvent
*/
function addLatLng(event) {
var path = flightPath.getPath();
// Because path is an MVCArray, we can simply append a new coordinate
// and it will automatically appear
path.push(event.latLng);
// Add a new marker at the new plotted point on the polyline.
var marker = new google.maps.Marker({
position: event.latLng,
title: '#' + path.getLength(),
map: map
});alert("Done");
}
简单地改变
google.maps.event.addListener(map, 'click', addLatLng);
到
但是,heading_changed事件没有与之关联的MouseeEvent,即您无法传入事件对象以获取事件发生位置的latLng,因为heading_changed
事件没有与其关联的位置。因此,您需要重新考虑希望函数做什么
google.maps.event.addListener(map, 'heading_changed', addLatLng);