diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb index 117af2a..69dce27 100644 --- a/app/helpers/posts_helper.rb +++ b/app/helpers/posts_helper.rb @@ -8,11 +8,6 @@ module PostsHelper image_url = subscription.layer.icon_url end - distance = post.distance.to_i - scale = 1.0 - scale = 0.5 if distance < 100.0 - scale = distance / 1000.0 if distance > 1000.0 - res = { :id => post.id, :imageURL => image_url, @@ -47,16 +42,21 @@ module PostsHelper :size => subscription.icon_size } - # http://layar.com/documentation/browser/api/getpois-response/hotspots/ - res[:transform] = { - :rotate => { - :rel => true, - :axis => { :x => 0, :y => 0, :z => 1 }, - :angle => 0 - }, - :translate => { :x => 0, :y => -0.075, :z => ENV['APOLLO_TRANSLATE_Z'] || 1.75 }, - :scale => scale + res[:icon] = { + :url => subscription.icon_url } + + # http://layar.com/documentation/browser/api/getpois-response/hotspots/ + # res[:transform] = { + # :rotate => { + # :rel => true, + # :axis => { :x => 0, :y => 0, :z => 1 }, + # :angle => 0 + # }, + # :translate => { :x => 0, :y => -0.075, :z => ENV['APOLLO_TRANSLATE_Z'] || 1.75 }, + # :scale => calculate_scale(post.distance.to_i), + # :distance => post.distance + # } end res end @@ -76,4 +76,11 @@ module PostsHelper decode_entities(s.gsub(/<.+?>/, '')) end + + def calculate_scale(distance) + scale = 1.0 + scale = 0.5 if distance < 100.0 + scale = distance / 1000.0 if distance > 1000.0 + scale + end end