我的地图上有 4 种类型的标记,我正在为每个点加载一个图像,具体取决于它的“学校类型”。这工作正常,但我在地图上得到了一个奇怪的伪影,这是我在使用标准标记图像时没有得到的。
def map
@json = School.where(:disabled => [false, nil]).to_gmaps4rails do |school, marker|
marker.infowindow render_to_string(:partial => "schools/marker", :locals => { :object => school })
if school.school_type_id == 1
marker.picture({ "picture" => view_context.image_path('map_icons/blue_P.png'),"width" => '20',"height" => '34'})
elsif school.school_type_id == 2
marker.picture({ "picture" => view_context.image_path('map_icons/red_C.png'),"width" => '20',"height" => '34'})
elsif school.school_type_id == 3
marker.picture({ "picture" => view_context.image_path('map_icons/yellow_J.png'),"width" => '20',"height" => '34'})
elsif school.school_type_id == 4
marker.picture({ "picture" => view_context.image_path('map_icons/green_I.png'),"width" => '20',"height" => '34'})
end
marker.json({ :id => school.id })
end
respond_to do |format|
format.html # index.html.erb
format.json { render json: @schools }
end
end
神器图片:
http://foa-approved.org/map_artifact1.png
http://foa-approved.org/map_artifact2.png
我正在为地图控件使用 css 修复:
.map_container img {
max-width: none;
}
这个修复可以在标记图像上工作还是完全是别的东西?