mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-23 16:49:40 +02:00
basics done for geocoder.
This commit is contained in:
@@ -108,6 +108,10 @@ form.hide {
|
||||
display:none;
|
||||
}
|
||||
|
||||
button:hover form.hide {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
|
||||
button {
|
||||
|
||||
+11
-12
@@ -126,22 +126,21 @@ window.iD = function(container) {
|
||||
gc.append('button').text('geocode').attr('class','narrow')
|
||||
.on('click', function() {
|
||||
d3.select(this)
|
||||
.classed('active', function() {
|
||||
if ( !gcForm.classed('hide')) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
})
|
||||
gcForm.classed('hide', function() {
|
||||
return !gcForm.classed('hide');
|
||||
});
|
||||
|
||||
.classed('active', function() {
|
||||
if ( !gcForm.classed('hide')) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
gcForm.classed('hide', function() {
|
||||
return !gcForm.classed('hide');
|
||||
});
|
||||
d3.select('.map-overlay input').node().focus();
|
||||
});
|
||||
var gcForm = gc.append('form')
|
||||
gcForm.attr('class','content map-overlay hide')
|
||||
.append('input')
|
||||
.attr ('autofocus','autofocus')
|
||||
.attr({
|
||||
type: 'text',
|
||||
placeholder: 'find a place'
|
||||
|
||||
@@ -4,6 +4,7 @@ iD.modes.DrawRoad = function(wayId, direction) {
|
||||
};
|
||||
|
||||
mode.enter = function() {
|
||||
|
||||
var map = mode.map,
|
||||
history = mode.history,
|
||||
controller = mode.controller,
|
||||
|
||||
@@ -53,7 +53,7 @@ iD.modes.Select = function (entity) {
|
||||
mode.enter = function () {
|
||||
iD.modes._dragFeatures(mode);
|
||||
|
||||
target = mode.map.surface.selectAll("*")
|
||||
target = mode.map.surface.selectAll('*')
|
||||
.filter(function (d) { return d === entity; });
|
||||
|
||||
d3.select('.inspector-wrap')
|
||||
@@ -88,7 +88,7 @@ iD.modes.Select = function (entity) {
|
||||
target.call(dragWay);
|
||||
}
|
||||
|
||||
mode.map.surface.on("click.browse", function () {
|
||||
mode.map.surface.on('click.browse', function () {
|
||||
var datum = d3.select(d3.event.target).datum();
|
||||
if (datum instanceof iD.Entity) {
|
||||
mode.controller.enter(iD.modes.Select(datum));
|
||||
@@ -116,7 +116,7 @@ iD.modes.Select = function (entity) {
|
||||
.on('touchstart.drag', null);
|
||||
}
|
||||
|
||||
mode.map.surface.on("click.browse", null);
|
||||
mode.map.surface.on('click.browse', null);
|
||||
mode.map.keybinding().on('⌫.browse', null);
|
||||
|
||||
mode.map.selection(null);
|
||||
|
||||
@@ -33,8 +33,8 @@ iD.Map = function() {
|
||||
.call(zoom);
|
||||
|
||||
surface = supersurface.append('svg')
|
||||
.on('mouseup', resetTransform)
|
||||
.on('touchend', resetTransform);
|
||||
.on('mouseup.reset-transform', resetTransform)
|
||||
.on('touchend.reset-transform', resetTransform);
|
||||
|
||||
defs = surface.append('defs');
|
||||
defs.append('clipPath')
|
||||
|
||||
+2
-2
@@ -40,14 +40,14 @@ iD.commit = function() {
|
||||
|
||||
body.append('button').text('Save')
|
||||
.attr('class', 'save')
|
||||
.on('click', function() {
|
||||
.on('click.save', function() {
|
||||
event.save({
|
||||
comment: d3.select('textarea.changeset-comment').node().value
|
||||
});
|
||||
});
|
||||
body.append('button').text('Cancel')
|
||||
.attr('class', 'cancel')
|
||||
.on('click', function() {
|
||||
.on('click.cancel', function() {
|
||||
event.cancel();
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ iD.confirm = function(message) {
|
||||
modal.select('.content')
|
||||
.append('button')
|
||||
.text('OK')
|
||||
.on('click', function() {
|
||||
.on('click.confirm', function() {
|
||||
modal.remove();
|
||||
});
|
||||
|
||||
|
||||
+69
-58
@@ -25,61 +25,72 @@ iD.layerswitcher = function(map) {
|
||||
}];
|
||||
|
||||
function layerswitcher(selection) {
|
||||
selection
|
||||
.append('button')
|
||||
.attr('class', 'narrow')
|
||||
.text('Layers')
|
||||
.on('click', function() {
|
||||
d3.select(this)
|
||||
.classed('active', function() {
|
||||
if ( !content.classed('hide')) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
})
|
||||
content.classed('hide', function() {
|
||||
return !content.classed('hide');
|
||||
});
|
||||
});
|
||||
|
||||
var content = selection
|
||||
.append('div')
|
||||
.attr('class', 'content map-overlay hide');
|
||||
.append('div').attr('class', 'content map-overlay hide');
|
||||
|
||||
var toggle = selection
|
||||
.append('button')
|
||||
.attr('class', 'narrow')
|
||||
.text('Layers')
|
||||
.on('click.toggle', function() {
|
||||
d3.select(this)
|
||||
.classed('active', function() {
|
||||
return content.classed('hide');
|
||||
});
|
||||
content.classed('hide', function() {
|
||||
if (content.classed('hide')) clickoutside(selection);
|
||||
else {
|
||||
d3.select('body').on('click.outside', null);
|
||||
selection.on('click.inside', null);
|
||||
}
|
||||
return !content.classed('hide');
|
||||
});
|
||||
});
|
||||
|
||||
function clickoutside(selection) {
|
||||
selection
|
||||
.on('click.inside', function() {
|
||||
return d3.event.stopPropagation();
|
||||
});
|
||||
d3.select('body')
|
||||
.on('click.outside', function() {
|
||||
toggle.on('click.toggle').apply(toggle.node(), d3.event);
|
||||
});
|
||||
}
|
||||
|
||||
opa = content
|
||||
.append('div')
|
||||
.attr('class', 'opacity-options-wrapper fillL2')
|
||||
.html("<em>Layers</em>")
|
||||
.append('ul')
|
||||
.attr('class', 'opacity-options')
|
||||
.selectAll('div.opacity')
|
||||
.data(opacities)
|
||||
.enter()
|
||||
.append('li')
|
||||
.attr('data-original-title', function(d) {
|
||||
return d.label + " opacity";
|
||||
})
|
||||
.on('click', function(d) {
|
||||
d3.select('#tile-g')
|
||||
.transition()
|
||||
.style('opacity', d.level)
|
||||
.attr('data-opacity', d.level);
|
||||
d3.selectAll('.opacity-options li')
|
||||
.classed('selected', false)
|
||||
d3.select(this)
|
||||
.classed('selected', true)
|
||||
})
|
||||
.html("<div class='select-box'></div>")
|
||||
.call(bootstrap.tooltip().placement('top'))
|
||||
.append('div')
|
||||
.attr('class', 'opacity')
|
||||
.style('opacity', function(d) {
|
||||
return d.level;
|
||||
});
|
||||
|
||||
// Make sure there is an active selection by default
|
||||
d3.select('.opacity-options li').classed('selected', true)
|
||||
.attr('class', 'opacity-options-wrapper fillL2')
|
||||
.html("<em>Layers</em>")
|
||||
.append('ul')
|
||||
.attr('class', 'opacity-options')
|
||||
.selectAll('div.opacity')
|
||||
.data(opacities)
|
||||
.enter()
|
||||
.append('li')
|
||||
.attr('data-original-title', function(d) {
|
||||
return d.label + " opacity";
|
||||
})
|
||||
.on('click.set-opacity', function(d) {
|
||||
d3.select('#tile-g')
|
||||
.transition()
|
||||
.style('opacity', d.level)
|
||||
.attr('data-opacity', d.level);
|
||||
d3.selectAll('.opacity-options li')
|
||||
.classed('selected', false);
|
||||
d3.select(this)
|
||||
.classed('selected', true);
|
||||
})
|
||||
.html("<div class='select-box'></div>")
|
||||
.call(bootstrap.tooltip().placement('top'))
|
||||
.append('div')
|
||||
.attr('class', 'opacity')
|
||||
.style('opacity', function(d) {
|
||||
return d.level;
|
||||
});
|
||||
// Make sure there is an active selection by default
|
||||
d3.select('.opacity-options li').classed('selected', true);
|
||||
|
||||
function selectLayer(d) {
|
||||
content.selectAll('a.layer')
|
||||
@@ -89,13 +100,12 @@ iD.layerswitcher = function(map) {
|
||||
}
|
||||
|
||||
content
|
||||
.append('ul')
|
||||
.append('ul')
|
||||
.attr('class', 'toggle-list')
|
||||
|
||||
.selectAll('a.layer')
|
||||
.data(sources)
|
||||
.enter()
|
||||
.append('li')
|
||||
.selectAll('a.layer')
|
||||
.data(sources)
|
||||
.enter()
|
||||
.append('li')
|
||||
.append('a')
|
||||
.attr('data-original-title', function(d) {
|
||||
return d.description;
|
||||
@@ -106,7 +116,7 @@ iD.layerswitcher = function(map) {
|
||||
return d.name;
|
||||
})
|
||||
.call(bootstrap.tooltip().placement('right'))
|
||||
.on('click', function(d) {
|
||||
.on('click.set-source', function(d) {
|
||||
d3.event.preventDefault();
|
||||
map.background.source(d.source);
|
||||
map.redraw();
|
||||
@@ -114,7 +124,8 @@ iD.layerswitcher = function(map) {
|
||||
})
|
||||
.insert('span')
|
||||
.attr('class','icon toggle');
|
||||
selectLayer(map.background.source());
|
||||
|
||||
selectLayer(map.background.source());
|
||||
}
|
||||
|
||||
return d3.rebind(layerswitcher, event, 'on');
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ iD.modal = function() {
|
||||
var shaded = d3.select(document.body)
|
||||
.append('div').attr('class', 'shaded')
|
||||
.style('opacity', 0)
|
||||
.on('click', function() {
|
||||
.on('click.remove-modal', function() {
|
||||
if (d3.event.target == this) this.remove();
|
||||
});
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ iD.userpanel = function(connection) {
|
||||
.attr('class', 'logout')
|
||||
.attr('href', '#')
|
||||
.text('logout')
|
||||
.on('click', function() {
|
||||
.on('click.logout', function() {
|
||||
d3.event.preventDefault();
|
||||
event.logout();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user