2013-05-31 3 views
0

привет, я бы изменил маркер на карте, я использую рельсы, и я написал эту функцию javascript для маркера set, поэтому, если я изменю маркер с url: «icona.png», где icona.png находится в той же папке рекламные акции не показывают мне маркер на карте. Зачем? как изменить рынок по умолчанию есть другой метод?Рельсы, как изменить маркер Google Maps?

 function setMarkers(map, locations) { 
     // Add markers to the map 

     // Marker sizes are expressed as a Size of X,Y 
     // where the origin of the image (0,0) is located 
     // in the top left of the image. 

     // Origins, anchor positions and coordinates of the marker 
     // increase in the X direction to the right and in 
     // the Y direction down. 
     var image = { 
      url: "icona.png", 
      // This marker is 20 pixels wide by 32 pixels tall. 
      size: new google.maps.Size(20, 32), 
      // The origin for this image is 0,0. 
      origin: new google.maps.Point(0,0), 
      // The anchor for this image is the base of the flagpole at 0,32. 
      anchor: new google.maps.Point(0, 32) 
     }; 
     var shadow = { 
      url: "icona.png", 
      // The shadow image is larger in the horizontal dimension 
      // while the position and offset are the same as for the main image. 
      size: new google.maps.Size(37, 32), 
      origin: new google.maps.Point(0,0), 
      anchor: new google.maps.Point(0, 32) 
     }; 
     // Shapes define the clickable region of the icon. 
     // The type defines an HTML <area> element 'poly' which 
     // traces out a polygon as a series of X,Y points. The final 
     // coordinate closes the poly by connecting to the first 
     // coordinate. 
     var shape = { 
      coord: [1, 1, 1, 20, 18, 20, 18 , 1], 
      type: 'poly' 
     }; 

ответ

3

Попробуйте поставить JavaScript в приложений/активов/JavaScripts/ и маркер в приложение/активов/изображений/ папке. Затем маршрут к изображению: "/assets/marker.png"

Вы можете прочитать здесь http://guides.rubyonrails.org/asset_pipeline.html

Смежные вопросы