【发布时间】:2017-05-07 12:24:25
【问题描述】:
我在 gmap4rails 中使用自定义标记选项,主要在 CoffeeScript 中实现。虽然标记的默认选项是添加阴影,但我希望将其删除,但无法找到从标记中删除阴影的设置。
观点:
创建自定义标记的类:
class CustomMarkerBuilder extends Gmaps.Google.Builders.Marker
create_marker: ->
options = _.extend @marker_options(), @rich_marker_options()
@serviceObject = new RichMarker options
rich_marker_options: ->
marker = document.createElement("div")
marker.setAttribute('class', 'custom_marker_content')
marker.innerHTML = this.args.custom_marker
marker.shadow
{ content: marker }
显示所有标记的 CoffeeScript 动作:
allLocations = root.table.rows().data()
$('#multi_markers').map ->
handler = Gmaps.build("Google", builders: { Marker: CustomMarkerBuilder })
handler.buildMap
internal:
id: "multi_markers"
, ->
for aLocation in allLocations
markers = handler.addMarkers([
{
lat: aLocation[9]
lng: aLocation[10]
custom_marker: "<img src='/assets/images/redDotMarker.png' width='40' height='40'>"
custom_infowindow: "Store Number: #{aLocation[1]}; Address: #{aLocation[2]}, #{aLocation[3]}; Major Bidding City: #{aLocation[6]}"
}
])
handler.bounds.extendWith markers
handler.fitMapToBounds()
return
如何从 CoffeeScript 的标记中移除阴影?
【问题讨论】:
标签: ruby-on-rails coffeescript gmaps4rails