覆盖物状态改变时触发的事件
mousemove mouSEOver mouSEOut
<!DOCTYPE HTML><HTML lang="en"head> Meta charset="UTF-8"Title>map</script type="text/JavaScript" src="https://webAPI.amap.com/maps?v=1.4.15&key=ce3b1a3a7e67fc75810ce1ba1f83c01a"></script> style> *{margin:0;paddingList-style none} #container wIDth100% height 100%topleftposition absolute; #panel fixed280px10pxrightbackground-color #fff} bodydiv ID="container"div="panel"> > var map=new AMap.Map("container,{ zoom:11121.54979229.868388],resizeEnable:true//不开启则无法触发resize事件 }); txt AMap.Text({ text:覆盖物事件] }).on(mouSEOverfunction(){ console.log(覆盖物移入); }).on(mouSEOut覆盖物移出mousemove覆盖物上移动中); }) txt.setMap(map); > HTML>
show hIDe
矢量图--圆 circle AMap.Circle({ center:[1000 }) circle.setMap(map); 矢量图--方 rect AMap.Rectangle({ bounds: AMap.Bounds( AMap.LngLat(),1)">121.56979229.848388)) }) rect.setMap(map); setTimeout((){ circle.hIDe(); },1)">2000) setTimeout((){ rect.hIDe(); },1)">4000(){ circle.show(); },1)">6000(){ rect.show(); },1)">8000) >
open() close()
ContextMenu指的是右键
map.zoomIn() map.zoomOut()
cm AMap.ContextMenu(); cm.addItem(放大一级(){ map.zoomIn();放大一级map的级别 },1)">) cm.addItem(缩小一级(){ map.zoomOut();缩小一级map的级别1) map.on(rightclick(e){ console.log(e.lnglat); cm.open(map,e.lnglat); 右键3秒后关闭 setTimeout((){ cm.close(); },1)">3000) }) >
总结
以上是内存溢出为你收集整理的高德地图API事件-鼠标事件全部内容,希望文章能够帮你解决高德地图API事件-鼠标事件所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)