简体   繁体   English

重复点击Cordova Googlemaps插件

[英]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.

相关问题 离子插件添加cordova-plugin-googlemaps后构建失败 - BUILD FAILED after ionic plugin add cordova-plugin-googlemaps Play 商店中的 Cordova-plugin-googlemaps 空白屏幕 - Cordova-plugin-googlemaps blank screen on Play store 使用Cordova插件通过WayPoints从源到目的地的路线添加了cordova-plugin-googlemaps - Directions from Source to Destinations via WayPoints using cordova plugin add cordova-plugin-googlemaps 地图拖动事件谷歌地图android sdk cordova cordova-plugin-googlemaps - map drag event google maps android sdk cordova cordova-plugin-googlemaps 在Android模拟器中使用Cordova Google Maps插件时出错:GoogleMaps插件中未定义getMap - Error using Cordova Google Maps plugin in android emulator: getMap is not defined in GoogleMaps plugin cordova-plugin-googlemaps如何从标记数组触发标记的info_window - cordova-plugin-googlemaps how to trigger the info_window of marker from marker array 为什么我使用cordova-plugin-googlemaps得到了空白地图 - Why have I got a blank map using cordova-plugin-googlemaps 当我尝试使用以下科尔多瓦google maps插件https://github.com/mapsplugin/cordova-plugin-googlemaps时出现错误 - I am getting an error when I tried to use the following cordova google maps plugin https://github.com/mapsplugin/cordova-plugin-googlemaps Gradle“ com.android.dex.DexException”构建了一个涉及cordova-plugin-googlemaps和ibm-mfp-push插件的应用程序。 - Gradle “com.android.dex.DexException” building an app involving cordova-plugin-googlemaps and ibm-mfp-push plugins. phonegap-googlemaps-plugin显示黑屏 - phonegap-googlemaps-plugin shows blank screen
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM