mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-31 01:09:22 +02:00
Disable mode buttons on leading and trailing debounce
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as d3 from 'd3';
|
||||
import _ from 'lodash';
|
||||
import { d3keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import {
|
||||
modeAddArea,
|
||||
modeAddLine,
|
||||
@@ -53,12 +54,6 @@ export function uiModes(context) {
|
||||
})
|
||||
);
|
||||
|
||||
context.map()
|
||||
.on('move.modes', _.debounce(update, 500));
|
||||
|
||||
context
|
||||
.on('enter.modes', update);
|
||||
|
||||
buttons
|
||||
.each(function(d) {
|
||||
d3.select(this)
|
||||
@@ -102,6 +97,17 @@ export function uiModes(context) {
|
||||
.call(keybinding);
|
||||
|
||||
|
||||
var debouncedUpdate = _.debounce(update, 500, { leading: true, trailing: true });
|
||||
|
||||
context.map()
|
||||
.on('move.modes', debouncedUpdate)
|
||||
.on('drawn.modes', debouncedUpdate);
|
||||
|
||||
context
|
||||
.on('enter.modes', update);
|
||||
|
||||
|
||||
|
||||
function update() {
|
||||
selection.selectAll('button.add-button')
|
||||
.property('disabled', !editable());
|
||||
|
||||
Reference in New Issue
Block a user