diff --git a/lib/gmaps4rails/markers_builder.rb b/lib/gmaps4rails/markers_builder.rb index 01b4de6b..c6bba149 100644 --- a/lib/gmaps4rails/markers_builder.rb +++ b/lib/gmaps4rails/markers_builder.rb @@ -15,8 +15,10 @@ module Gmaps4rails # marker.infowindow render_to_string(:partial => "/users/my_template", :locals => { :object => user}).gsub(/\n/, '').gsub(/"/, '\"') # marker.picture({ # :url => "http://www.blankdots.com/img/github-32x32.png", - # :width => "32", - # :height => "32" + # :width => "64", + # :height => "64", + # :scaledWidth => "32", # Scaled width is half of the retina resolution; optional + # :scaledHeight => "32", # Scaled width is half of the retina resolution; optional # }) # marker.title "i'm the title" # marker.json({ :id => user.id }) diff --git a/vendor/assets/javascripts/gmaps/google/builders/marker.coffee b/vendor/assets/javascripts/gmaps/google/builders/marker.coffee index 8daf783b..f9f8b4d7 100644 --- a/vendor/assets/javascripts/gmaps/google/builders/marker.coffee +++ b/vendor/assets/javascripts/gmaps/google/builders/marker.coffee @@ -13,6 +13,8 @@ class @Gmaps.Google.Builders.Marker extends Gmaps.Objects.BaseBuilder # url # width # height + # scaledWidth + # scaledHeight # shadow # anchor: [x,y] # url @@ -72,14 +74,17 @@ class @Gmaps.Google.Builders.Marker extends Gmaps.Objects.BaseBuilder @constructor.CACHE_STORE[picture_args.url] - _picture_args: (picture_name)-> - { - url: @args[picture_name].url - anchor: @_createImageAnchorPosition @args[picture_name].anchor - size: new(@primitives().size)(@args[picture_name].width, @args[picture_name].height) + + _picture_args: (picture_name) -> + return_args = + url: @args[picture_name].url + anchor: @_createImageAnchorPosition @args[picture_name].anchor + size: new(@primitives().size)(@args[picture_name].width, @args[picture_name].height) scaledSize: null - origin: null - } + origin: null + if @args[picture_name].scaledWidth and @args[picture_name].scaledHeight + _.extend return_args, scaledSize: new(@primitives().size)(@args[picture_name].scaledWidth, @args[picture_name].scaledHeight) + return_args _createImageAnchorPosition : (anchorLocation) -> return null unless _.isArray anchorLocation