mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-24 17:14:04 +02:00
display lane count on sidebar
This commit is contained in:
committed by
Bryan Housel
parent
d130456393
commit
332200b404
@@ -5,6 +5,7 @@ export { combo, typeCombo, multiCombo } from './combo';
|
||||
export { cycleway } from './cycleway';
|
||||
export { text, url, number, email, tel } from './input';
|
||||
export { localized } from './localized';
|
||||
export { lanes } from './lanes';
|
||||
export { maxspeed } from './maxspeed';
|
||||
export { radio } from './radio';
|
||||
export { restrictions } from './restrictions';
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
export function lanes(field, context) {
|
||||
var dispatch = d3.dispatch('change'),
|
||||
wayID,
|
||||
laneData;
|
||||
|
||||
function lanes(selection) {
|
||||
// if form field is hidden or has detached from dom, clean up.
|
||||
if (!d3.select('.inspector-wrap.inspector-hidden').empty() || !selection.node().parentNode) {
|
||||
selection.call(lanes.off);
|
||||
return;
|
||||
}
|
||||
|
||||
laneData = context.entity(wayID).lanes();
|
||||
|
||||
var wrap = selection.selectAll('.preset-input-wrap')
|
||||
.data([0]);
|
||||
|
||||
var enter = wrap.enter()
|
||||
.append('div')
|
||||
.attr('class', 'preset-input-wrap');
|
||||
|
||||
enter
|
||||
.append('div')
|
||||
.attr('class', 'lane-count')
|
||||
.append('span');
|
||||
|
||||
selection.selectAll('.lane-count')
|
||||
.text(laneData.tagged.lanes.count || laneData.defaults.lanes.count);
|
||||
|
||||
}
|
||||
|
||||
|
||||
lanes.entity = function(_) {
|
||||
if (!wayID || wayID !== _.id) {
|
||||
wayID = _.id;
|
||||
}
|
||||
};
|
||||
|
||||
lanes.tags = function() {};
|
||||
lanes.focus = function() {};
|
||||
lanes.off = function() {};
|
||||
|
||||
return d3.rebind(lanes, dispatch, 'on');
|
||||
}
|
||||
Reference in New Issue
Block a user