mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-25 01:24:05 +02:00
Enable nudging the selection via shift+arrow keys and shift+command+arrow keys to nudge more (close #7186)
No longer nudge the viewport with shift+arrow keys
This commit is contained in:
@@ -4,6 +4,7 @@ import { t } from '../core/localizer';
|
||||
|
||||
import { actionAddMidpoint } from '../actions/add_midpoint';
|
||||
import { actionDeleteRelation } from '../actions/delete_relation';
|
||||
import { actionMove } from '../actions/move';
|
||||
|
||||
import { behaviorBreathe } from '../behavior/breathe';
|
||||
import { behaviorHover } from '../behavior/hover';
|
||||
@@ -11,6 +12,8 @@ import { behaviorLasso } from '../behavior/lasso';
|
||||
import { behaviorPaste } from '../behavior/paste';
|
||||
import { behaviorSelect } from '../behavior/select';
|
||||
|
||||
import { operationMove } from '../operations/move';
|
||||
|
||||
import { geoExtent, geoChooseEdge } from '../geo';
|
||||
import { modeBrowse } from './browse';
|
||||
import { modeDragNode } from './drag_node';
|
||||
@@ -212,6 +215,14 @@ export function modeSelect(context, selectedIDs) {
|
||||
.on([']', 'pgdown'], nextVertex)
|
||||
.on(['{', uiCmd('⌘['), 'home'], firstVertex)
|
||||
.on(['}', uiCmd('⌘]'), 'end'], lastVertex)
|
||||
.on(uiCmd('⇧←'), nudgeSelection([-10, 0]))
|
||||
.on(uiCmd('⇧↑'), nudgeSelection([0, -10]))
|
||||
.on(uiCmd('⇧→'), nudgeSelection([10, 0]))
|
||||
.on(uiCmd('⇧↓'), nudgeSelection([0, 10]))
|
||||
.on(uiCmd('⇧⌘←'), nudgeSelection([-100, 0]))
|
||||
.on(uiCmd('⇧⌘↑'), nudgeSelection([0, -100]))
|
||||
.on(uiCmd('⇧⌘→'), nudgeSelection([100, 0]))
|
||||
.on(uiCmd('⇧⌘↓'), nudgeSelection([0, 100]))
|
||||
.on(['\\', 'pause'], nextParent)
|
||||
.on('⎋', esc, true);
|
||||
|
||||
@@ -258,6 +269,24 @@ export function modeSelect(context, selectedIDs) {
|
||||
}
|
||||
|
||||
|
||||
function nudgeSelection(delta) {
|
||||
return function() {
|
||||
d3_event.stopImmediatePropagation();
|
||||
|
||||
var moveOp = operationMove(context, selectedIDs);
|
||||
if (moveOp.disabled()) {
|
||||
context.ui().flash
|
||||
.duration(4000)
|
||||
.iconName('#iD-operation-' + moveOp.id)
|
||||
.iconClass('operation disabled')
|
||||
.text(moveOp.tooltip)();
|
||||
} else {
|
||||
context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function didDoubleUp(loc) {
|
||||
if (!context.map().withinEditableZoom()) return;
|
||||
|
||||
|
||||
+5
-4
@@ -319,10 +319,10 @@ export function uiInit(context) {
|
||||
.on('↑', pan([0, panPixels]))
|
||||
.on('→', pan([-panPixels, 0]))
|
||||
.on('↓', pan([0, -panPixels]))
|
||||
.on(['⇧←', uiCmd('⌘←')], pan([map.dimensions()[0], 0]))
|
||||
.on(['⇧↑', uiCmd('⌘↑')], pan([0, map.dimensions()[1]]))
|
||||
.on(['⇧→', uiCmd('⌘→')], pan([-map.dimensions()[0], 0]))
|
||||
.on(['⇧↓', uiCmd('⌘↓')], pan([0, -map.dimensions()[1]]))
|
||||
.on(uiCmd('⌘←'), pan([map.dimensions()[0], 0]))
|
||||
.on(uiCmd('⌘↑'), pan([0, map.dimensions()[1]]))
|
||||
.on(uiCmd('⌘→'), pan([-map.dimensions()[0], 0]))
|
||||
.on(uiCmd('⌘↓'), pan([0, -map.dimensions()[1]]))
|
||||
.on(uiCmd('⌘' + t('background.key')), function quickSwitch() {
|
||||
if (d3_event) {
|
||||
d3_event.stopImmediatePropagation();
|
||||
@@ -399,6 +399,7 @@ export function uiInit(context) {
|
||||
|
||||
function pan(d) {
|
||||
return function() {
|
||||
if (d3_event.shiftKey) return;
|
||||
if (context.container().select('.combobox').size()) return;
|
||||
d3_event.preventDefault();
|
||||
context.map().pan(d, 100);
|
||||
|
||||
Reference in New Issue
Block a user