Move lib/d3.keybinding.js -> util/keybinding.js

almost none of the original d3 "plugin" code remains
This commit is contained in:
Bryan Housel
2018-11-13 13:42:09 -05:00
parent 2ffcec965a
commit bb30cbf555
35 changed files with 176 additions and 231 deletions
+2 -2
View File
@@ -7,12 +7,12 @@ import {
select as d3_select
} from 'd3-selection';
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
import { utilKeybinding } from '../util';
import { uiCmd } from '../ui';
export function behaviorCopy(context) {
var keybinding = d3_keybinding('copy');
var keybinding = utilKeybinding('copy');
function groupEntities(ids, graph) {
+2 -3
View File
@@ -7,12 +7,11 @@ import {
touches as d3_touches
} from 'd3-selection';
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
import { behaviorEdit } from './edit';
import { behaviorHover } from './hover';
import { behaviorTail } from './tail';
import { geoChooseEdge, geoVecLength } from '../geo';
import { utilRebind } from '../util/rebind';
import { utilKeybinding, utilRebind } from '../util';
var _usedTails = {};
@@ -25,7 +24,7 @@ export function behaviorDraw(context) {
'move', 'click', 'clickWay', 'clickNode', 'undo', 'cancel', 'finish'
);
var keybinding = d3_keybinding('draw');
var keybinding = utilKeybinding('draw');
var hover = behaviorHover(context).altDisables(true)
.on('hover', context.ui().sidebar.hover);
+3 -5
View File
@@ -5,8 +5,6 @@ import {
select as d3_select
} from 'd3-selection';
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
import {
actionAddMidpoint,
actionMoveNode,
@@ -17,6 +15,7 @@ import { behaviorDraw } from './draw';
import { geoChooseEdge, geoHasSelfIntersections } from '../geo';
import { modeBrowse, modeSelect } from '../modes';
import { osmNode } from '../osm';
import { utilKeybinding } from '../util';
export function behaviorDrawWay(context, wayId, index, mode, startGraph) {
@@ -41,9 +40,8 @@ export function behaviorDrawWay(context, wayId, index, mode, startGraph) {
_tempEdits++;
function keydown() {
if (d3_event.keyCode === d3_keybinding.modifierCodes.alt) {
if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
if (context.surface().classed('nope')) {
context.surface()
.classed('nope-suppressed', true);
@@ -56,7 +54,7 @@ export function behaviorDrawWay(context, wayId, index, mode, startGraph) {
function keyup() {
if (d3_event.keyCode === d3_keybinding.modifierCodes.alt) {
if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
if (context.surface().classed('nope-suppressed')) {
context.surface()
.classed('nope', true);
+3 -4
View File
@@ -5,9 +5,8 @@ import {
select as d3_select
} from 'd3-selection';
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
import { osmEntity, osmNote } from '../osm';
import { utilRebind } from '../util/rebind';
import { utilKeybinding, utilRebind } from '../util';
/*
@@ -29,7 +28,7 @@ export function behaviorHover(context) {
function keydown() {
if (_altDisables && d3_event.keyCode === d3_keybinding.modifierCodes.alt) {
if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
_selection.selectAll('.hover')
.classed('hover-suppressed', true)
.classed('hover', false);
@@ -43,7 +42,7 @@ export function behaviorHover(context) {
function keyup() {
if (_altDisables && d3_event.keyCode === d3_keybinding.modifierCodes.alt) {
if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
_selection.selectAll('.hover-suppressed')
.classed('hover-suppressed', false)
.classed('hover', true);
+2 -2
View File
@@ -3,8 +3,8 @@ import {
select as d3_select
} from 'd3-selection';
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
import { uiFlash } from '../ui';
import { utilKeybinding } from '../util';
/* Creates a keybinding behavior for an operation */
@@ -14,7 +14,7 @@ export function behaviorOperation() {
var behavior = function () {
if (_operation && _operation.available()) {
keybinding = d3_keybinding('behavior.key.' + _operation.id);
keybinding = utilKeybinding('behavior.key.' + _operation.id);
keybinding.on(_operation.keys, function() {
d3_event.preventDefault();
var disabled = _operation.disabled();
+2 -3
View File
@@ -6,8 +6,6 @@ import {
select as d3_select
} from 'd3-selection';
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
import {
actionCopyEntities,
actionMove
@@ -21,10 +19,11 @@ import {
import { modeMove } from '../modes';
import { uiCmd } from '../ui';
import { utilKeybinding } from '../util';
export function behaviorPaste(context) {
var keybinding = d3_keybinding('paste');
var keybinding = utilKeybinding('paste');
function doPaste() {