Browse Source

Use standard icon URL for POIs

master
Adrian Short 11 years ago
parent
commit
ab4caaae3e
1 changed files with 21 additions and 14 deletions
  1. +21
    -14
      app/helpers/posts_helper.rb

+ 21
- 14
app/helpers/posts_helper.rb View File

@@ -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

Loading…
Cancel
Save