Use context.keybinding for keybindings that don't change

(closes #5487)
This commit is contained in:
Bryan Housel
2018-11-13 20:57:21 -05:00
parent bb30cbf555
commit 152022aec4
37 changed files with 252 additions and 319 deletions
+9 -25
View File
@@ -1,30 +1,15 @@
import _invert from 'lodash-es/invert';
import _mapValues from 'lodash-es/mapValues';
import {
event as d3_event,
select as d3_select
} from 'd3-selection';
import {
actionCopyEntities,
actionMove
} from '../actions';
import {
geoExtent,
geoPointInPolygon,
geoVecSubtract
} from '../geo';
import { event as d3_event } from 'd3-selection';
import { actionCopyEntities, actionMove } from '../actions';
import { geoExtent, geoPointInPolygon, geoVecSubtract } from '../geo';
import { modeMove } from '../modes';
import { uiCmd } from '../ui';
import { utilKeybinding } from '../util';
export function behaviorPaste(context) {
var keybinding = utilKeybinding('paste');
function doPaste() {
d3_event.preventDefault();
@@ -78,17 +63,16 @@ export function behaviorPaste(context) {
}
function paste() {
keybinding.on(uiCmd('⌘V'), doPaste);
d3_select(document).call(keybinding);
return paste;
function behavior() {
context.keybinding().on(uiCmd('⌘V'), doPaste);
return behavior;
}
paste.off = function() {
d3_select(document).call(keybinding.off);
behavior.off = function() {
context.keybinding().off(uiCmd('⌘V'));
};
return paste;
return behavior;
}