Skip to content

Commit

Permalink
added anchor to richmarker
Browse files Browse the repository at this point in the history
  • Loading branch information
apneadiving committed Aug 22, 2011
1 parent bcf586f commit 8b85008
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
20 changes: 20 additions & 0 deletions history/richmarker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 10 additions & 12 deletions public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ Gmaps4Rails.createMarker = function(args){
if (args.marker_picture === "" && args.rich_marker === null) {
return new google.maps.Marker({position: markerLatLng, map: Gmaps4Rails.map, title: args.marker_title, draggable: args.marker_draggable});
}
else if (args.rich_marker !== null){
return new RichMarker({position: markerLatLng,
map: Gmaps4Rails.map,
draggable: args.marker_draggable,
content: args.rich_marker,
flat: false,
anchor: args.marker_anchor === null ? 0 : args.marker_anchor[0]
});
}
else {
// calculate MarkerImage anchor location
var imageAnchorPosition = this.createImageAnchorPosition(args.marker_anchor);
Expand All @@ -109,18 +118,7 @@ Gmaps4Rails.createMarker = function(args){
//create or retrieve existing MarkerImages
var markerImage = this.createOrRetrieveImage(args.marker_picture, args.marker_width, args.marker_height, imageAnchorPosition);
var shadowImage = this.createOrRetrieveImage(args.shadow_picture, args.shadow_width, args.shadow_height, shadowAnchorPosition);
if (args.rich_marker === null) {
return new google.maps.Marker({position: markerLatLng, map: this.map, icon: markerImage, title: args.marker_title, draggable: args.marker_draggable, shadow: shadowImage});
}
else {
return new RichMarker({
position: markerLatLng,
map: Gmaps4Rails.map,
draggable: args.marker_draggable,
content: args.rich_marker,
flat: false
});
}
return new google.maps.Marker({position: markerLatLng, map: this.map, icon: markerImage, title: args.marker_title, draggable: args.marker_draggable, shadow: shadowImage});
}
};

Expand Down
1 change: 1 addition & 0 deletions test/dummy/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def gmaps4rails_marker_picture
{
"width" => "32",
"height" => "32",
"marker_anchor" => [2, -30],
"rich_marker" => "<div class='my-marker'><img height='30' width='30' src='http://farm4.static.flickr.com/3212/3012579547_097e27ced9_m.jpg'/></div>",
"shadow_picture" => "https://secure.gravatar.com/avatar/808bec1c640143bd7091888d9edfb2f2.png",
"shadow_height" => 40,
Expand Down

0 comments on commit 8b85008

Please sign in to comment.