Google maps 点击并按住位置,在地图上添加标记

Google maps 点击并按住位置,在地图上添加标记,google-maps,google-maps-markers,Google Maps,Google Maps Markers,我已经成功创建了一个google API,并使用了地图和阅读指南,但没有一个解决了以下功能: 点击并按住某个位置可添加标记 在大多数现有的指南中都解释了如何制作“硬烧”标记,但事实并非如此。例如 有人能帮我吗 这些应该适合您: function tapHold(map, length) { this.length_ = length; var me = this; me.map_ = map; google.maps.event.addListener(map

我已经成功创建了一个google API,并使用了地图和阅读指南,但没有一个解决了以下功能:

  • 点击并按住某个位置可添加标记
在大多数现有的指南中都解释了如何制作“硬烧”标记,但事实并非如此。例如


有人能帮我吗

这些应该适合您:

function tapHold(map, length)
{
    this.length_ = length;
    var me = this;
    me.map_ = map;
    google.maps.event.addListener(map, 'mousedown', function(e) { me.onMouseDown_(e) });
    };

tapHold.prototype.onMouseDown_ = function() { this.down_ = +new Date; };
new tapHold(map, 300);
google.maps.event.addListener( map,
                               'longpress',
                               function(event) 
                               {
                                   <YOUR CODE>
                                   };
                               );
功能点击保持(地图,长度)
{
这个长度u=长度;
var me=这个;
me.map=map;
google.maps.event.addListener(映射,'mousedown',函数(e){me.onMouseDown_ue});
};
tapHold.prototype.onMouseDown=function(){this.down=+new Date;};
新tapHold(地图,300);
google.maps.event.addListener(map,
"朗普",,
功能(事件)
{
};
);

谢谢。我遵循了上面描述中的链接。这可能是个问题,但我要把代码放在哪里呢?