소스 검색

Use standard icon URL for POIs

master
Adrian Short 11 년 전
부모
커밋
ab4caaae3e
1개의 변경된 파일21개의 추가작업 그리고 14개의 파일을 삭제
  1. +21
    -14
      app/helpers/posts_helper.rb

+ 21
- 14
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

불러오는 중...
취소
저장