mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-18 14:45:12 +02:00
28 lines
737 B
JavaScript
28 lines
737 B
JavaScript
iD.ui.preset.defaultcheck = function(field) {
|
|
|
|
var event = d3.dispatch('change', 'close'),
|
|
input;
|
|
|
|
var check = function(selection) {
|
|
|
|
input = selection.append('input')
|
|
.attr('type', 'checkbox')
|
|
.attr('id', 'preset-input-' + field.id)
|
|
.on('change', function() {
|
|
var t = {};
|
|
t[field.key] = input.property('checked') ? field.value || 'yes' : undefined;
|
|
event.change(t);
|
|
});
|
|
};
|
|
|
|
check.tags = function(tags) {
|
|
input.property('checked', !!tags[field.key] && tags[field.key] !== 'no');
|
|
};
|
|
|
|
check.focus = function() {
|
|
input.node().focus();
|
|
};
|
|
|
|
return d3.rebind(check, event, 'on');
|
|
};
|