mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 23:44:47 +02:00
Inject connection dependency in map
This commit is contained in:
+6
-4
@@ -4,8 +4,10 @@ var iD = function(container) {
|
||||
var m = container.append('div')
|
||||
.attr('id', 'map');
|
||||
|
||||
var map = iD.Map(m.node())
|
||||
.setAPI('http://api06.dev.openstreetmap.org/api/0.6/');
|
||||
var connection = iD.Connection()
|
||||
.url('http://api06.dev.openstreetmap.org/api/0.6/');
|
||||
|
||||
var map = iD.Map(m.node(), connection);
|
||||
|
||||
var controller = iD.Controller(map);
|
||||
|
||||
@@ -137,12 +139,12 @@ var iD = function(container) {
|
||||
if (oauth.authenticated()) {
|
||||
oauth.xhr({ method: 'GET', path: '/user/details' }, function(user_details) {
|
||||
var u = user_details.getElementsByTagName('user')[0];
|
||||
map.connection.user({
|
||||
connection.user({
|
||||
display_name: u.attributes.display_name.nodeValue,
|
||||
id: u.attributes.id.nodeValue
|
||||
});
|
||||
d3.select('.messages').text('logged in as ' +
|
||||
map.connection.user().display_name);
|
||||
connection.user().display_name);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
iD.Map = function(elem) {
|
||||
iD.Map = function(elem, connection) {
|
||||
|
||||
if (!iD.supported()) {
|
||||
elem.innerHTML = 'This editor is supported in Firefox, Chrome, Safari, Opera, ' +
|
||||
@@ -12,7 +12,6 @@ iD.Map = function(elem) {
|
||||
dimensions = { width: null, height: null },
|
||||
dispatch = d3.dispatch('move', 'update'),
|
||||
history = iD.History(),
|
||||
connection = iD.Connection(),
|
||||
inspector = iD.Inspector(),
|
||||
parent = d3.select(elem),
|
||||
selection = null,
|
||||
@@ -535,11 +534,6 @@ iD.Map = function(elem) {
|
||||
return map;
|
||||
}
|
||||
|
||||
function setAPI(x) {
|
||||
connection.url(x);
|
||||
return map;
|
||||
}
|
||||
|
||||
function commit() {
|
||||
var modified = _.filter(history.graph().entities, function(e) {
|
||||
return e.modified;
|
||||
@@ -583,10 +577,8 @@ iD.Map = function(elem) {
|
||||
map.zoomIn = zoomIn;
|
||||
map.zoomOut = zoomOut;
|
||||
|
||||
map.connection = connection;
|
||||
map.projection = projection;
|
||||
map.setSize = setSize;
|
||||
map.setAPI = setAPI;
|
||||
|
||||
map.history = history;
|
||||
map.surface = surface;
|
||||
|
||||
Reference in New Issue
Block a user