简体   繁体   English

将图像放置在Google Maps标记图标内

[英]Place an image inside of a google maps marker icon

Currently the markers on my Google Maps Map view appear to look like the first picture I uploaded, however I need to find a way to add a thumbnail in the center of the image similar to the second view, I am unsure of how to do this as the thumbnail is dynamic so I cannot set it to a specific image like I am doing by setting the marker.icon to the icons bubble image. 目前,我在Google Maps Map视图上的标记看起来像我上传的第一张图片,但是我需要找到一种方法来像第二张视图一样在图像的中心添加缩略图,我不确定该怎么做因为缩略图是动态的,所以我无法像设置标记图标图标气泡图像那样将其设置为特定图像。 Has anybody attempted anything like this before? 有人尝试过这样的事情吗? The thumbnails are being retrieved from a Parse server so I cannot prepare this ahead of time with code. 缩略图是从Parse服务器中检索的,因此我无法使用代码提前进行准备。

在此处输入图片说明

在此处输入图片说明

I had a similar problem in a project a while back. 前一段时间我在一个项目中遇到了类似的问题。 What I did to solve it, was in the javascript I started by making all the markers set to be hidden initially. 我要做的是在JavaScript中,首先将所有标记设置为隐藏。 As I added each one I added an eventListener to the src of the icon image so that when it loaded I could switch the marker on with setAnimation("BOUNCE") to make it look intentional. 当我添加每个对象时,我在图标图像的src中添加了一个eventListener,以便在加载时可以使用setAnimation(“ BOUNCE”)将标记打开,以使其看起来有意。 That's the idea and it worked for me. 这就是想法,对我有用。 Let me know if you run into any bumps. 让我知道您是否遇到任何麻烦。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM