0

マップ上に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-authorized.org/map_artifact1.png

http://foa-authorized.org/map_artifact2.png

マップコントロールにcss修正を使用しています:

.map_container img {
    max-width: none;
}

この修正はマーカー画像で機能しますか、それともまったく別のものですか?

4

0 に答える 0