[英]Repeated clicks on Cordova Googlemaps plugin
I have a very simple test map for the Cordova Google maps plugin (using version @ionic-native/google-maps@3.10.3). 对于Cordova Google地图插件,我有一个非常简单的测试地图(使用@ ionic-native / google-maps @ 3.10.3版本)。 I'm just trying to get a feel for it before using it. 我只是想在使用它之前对它有所了解。 I have a click event handler in there but it only handles the first click. 我那里有一个click事件处理程序,但它只处理第一次单击。 After that, it stops responding to any future clicks. 此后,它将停止响应任何将来的点击。 Here is the code for the map onready: 这是地图就绪的代码:
map.one(GoogleMapsEvent.MAP_READY).then(() => {
map.one(GoogleMapsEvent.MAP_LONG_CLICK).then((latLng) => {
console.log("long click: ", latLng);
});
});
Also, why is it map.one instead of map.on? 另外,为什么它是map.one而不是map.on?
Here is my ionic info: 这是我的离子信息:
Cordova CLI: 6.5.0
Ionic Framework Version: 3.3.0
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.
ios-deploy version: Not install
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.0
Xcode version: Not installed
Check docs again: https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v1.4.0/class/Map/README.md . 再次检查文档: https : //github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v1.4.0/class/Map/README.md 。 Its asking for you to pass in call back function when the event is fired. 当事件触发时,它要求您传递回叫功能。 There is no Promise return which is how your code is. 没有Promise返回,这就是您的代码的方式。
var evtName = plugin.google.maps.event.MAP_LONG_CLICK;
map.on(evtName, function(latLng) {
alert("Map was long clicked.\n" +
latLng.toUrlValue());
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.