mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 23:44:47 +02:00
Use context.keybinding for keybindings that don't change
(closes #5487)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user