]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/_potlatch2.html.erb
When asked to edit an object centre on the correct location
[rails.git] / app / views / site / _potlatch2.html.erb
index e7a2564f916eb97118ffba9433147f9f752b2b7a..c443a917ac272f5eb6c40a46990411cfdba132ab 100644 (file)
     // 700,600 for fixed size, 100%,100% for resizable
   }
 
+  <% if params[:node] -%>
+  <% bbox = Node.find(params[:node]).bbox.to_unscaled -%>
+  doSWF(<%= bbox.centre_lat %>,<%= bbox.centre_lon %>,16);
+  <% elsif params[:way] -%>
+  <% bbox = Way.find(params[:way]).bbox.to_unscaled -%>
+  doSWF(<%= bbox.centre_lat %>,<%= bbox.centre_lon %>,16);
+  <% else -%>
   doSWF(<%= @lat || 'null' %>,<%= @lon || 'null' %>,<%= @zoom %>);
+  <% end -%>
 
   function setPosition(lat, lon, zoom) {
     $("#potlatch").each(function () {