Call updatelinks when map moves
authorJohn Firebaugh <john.firebaugh@gmail.com>
Thu, 18 Apr 2013 21:57:25 +0000 (14:57 -0700)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Fri, 3 May 2013 17:52:42 +0000 (10:52 -0700)
Fixes systemed/iD#1330.

app/views/site/id_iframe.html.erb

index 5c061ea3a40e42094bae78834e921a47d1cc17eb..b32b96a43aa330d5d9c9262ab425cc58eeb52ffd 100644 (file)
         oauth_token_secret: "<%= token.secret %>"
       });
 
+    id.map().on('move.embed', function() {
+      var extent = id.map().extent(),
+          zoom = ~~id.map().zoom(),
+          center = id.map().center();
+
+      parent.updatelinks(
+        center[0],
+        center[1],
+        zoom,
+        null,
+        extent[0][0],
+        extent[0][1],
+        extent[1][0],
+        extent[1][1]);
+    });
+
     d3.select('#id-container')
       .call(id.ui());
   }