mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-14 01:33:03 +00:00
Make increment decrement functional. Fixes #990
This commit is contained in:
@@ -938,8 +938,8 @@ input[type=number] {
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
|
||||
.spin-control button.descend::after,
|
||||
.spin-control button.ascend::after {
|
||||
.spin-control button.decrement::after,
|
||||
.spin-control button.increment::after {
|
||||
content:"";
|
||||
height: 0; width: 0;
|
||||
position: absolute;
|
||||
@@ -947,13 +947,13 @@ input[type=number] {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.spin-control button.descend::after {
|
||||
.spin-control button.decrement::after {
|
||||
border-top: 5px solid #CCC;
|
||||
border-left: 5px solid transparent;
|
||||
border-right: 5px solid transparent;
|
||||
}
|
||||
|
||||
.spin-control button.ascend::after {
|
||||
.spin-control button.increment::after {
|
||||
border-bottom: 5px solid #CCC;
|
||||
border-left: 5px solid transparent;
|
||||
border-right: 5px solid transparent;
|
||||
|
||||
@@ -15,12 +15,28 @@ iD.ui.preset.url = function(field) {
|
||||
.on('change', change)
|
||||
.call(iD.behavior.accept().on('accept', event.close));
|
||||
|
||||
function pm(elem, x) {
|
||||
var num = elem.value ?
|
||||
parseInt(elem.value, 10) : 0;
|
||||
if (!isNaN(num)) elem.value = num + x;
|
||||
}
|
||||
|
||||
if (field.type == 'number') {
|
||||
var numbercontrols = selection.append('div')
|
||||
.attr('class', 'spin-control');
|
||||
|
||||
numbercontrols.append('button').attr('class', 'ascend');
|
||||
numbercontrols.append('button').attr('class', 'descend');
|
||||
numbercontrols
|
||||
.append('button')
|
||||
.attr('class', 'increment')
|
||||
.on('click', function() {
|
||||
pm(input.node(), 1);
|
||||
});
|
||||
numbercontrols
|
||||
.append('button')
|
||||
.attr('class', 'decrement')
|
||||
.on('click', function() {
|
||||
pm(input.node(), -1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user