Google地图v3多段线工具提示 [英] Google maps v3 polyline tooltip

查看:97
本文介绍了Google地图v3多段线工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谷歌地图标记对象(google.maps.Marker)具有title属性,因此当用户将鼠标移动到标记上方时,会显示一个简单的工具提示。



多段线上没有title属性(google.maps.Polyline)。有没有一种方法可以做到这一点/在V3模拟此? 我可以在V2中做到这一点,我找不到V3的例子。

如果我没有弄错,我不认为可以设置工具提示,因为正如你所提到的那样,PolygonOptions对象中没有title属性。但是你可以制作一个div ,看起来完全一样作为工具提示,并让它在鼠标移动事件期间在鼠标尖端说。我还试图找到一个解决方案,将此工具提示放置在多边形中心的某处,但我认为它也是如此很多麻烦,这就是为什么我也认为谷歌的人也没有实现它。
干杯


A google maps marker object (google.maps.Marker) has a title property, so when a user moves their mouse over the marker a simple tooltip is displayed.

There isn't a title property on a polyline (google.maps.Polyline). Is there a way I can do this / simulate this in V3? I could do this in V2, and I can't find an example for V3.

解决方案

If i'm not mistaken i don't think it is possible to set the tooltip since as you mentioned there is not a title property in PolygonOptions object.But you can make a div that looks exactly the same as the tooltip and place it let's say in the tip of your mouse during the mousemove event.I tried also to find a solution to place this tooltip somewhere in the center of the polygon but i think it is too much of a trouble that's why i also think the google guys didn't implement it also. Cheers

这篇关于Google地图v3多段线工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆