mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-19 23:14:47 +02:00
Initial support for D3 v6.2.0
This commit is contained in:
+27
-36
@@ -1,8 +1,6 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
|
||||
import {
|
||||
customEvent as d3_customEvent,
|
||||
event as d3_event,
|
||||
select as d3_select,
|
||||
selection as d3_selection
|
||||
} from 'd3-selection';
|
||||
@@ -37,8 +35,8 @@ export function behaviorDrag() {
|
||||
|
||||
var _origin = null;
|
||||
var _selector = '';
|
||||
var _event;
|
||||
var _target;
|
||||
var _targetNode;
|
||||
var _targetEntity;
|
||||
var _surface;
|
||||
var _pointerId;
|
||||
|
||||
@@ -56,25 +54,16 @@ export function behaviorDrag() {
|
||||
};
|
||||
|
||||
|
||||
function eventOf(thiz, argumentz) {
|
||||
return function(e1) {
|
||||
e1.target = behavior;
|
||||
d3_customEvent(e1, dispatch.apply, dispatch, [e1.type, thiz, argumentz]);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function pointerdown() {
|
||||
function pointerdown(d3_event) {
|
||||
|
||||
if (_pointerId) return;
|
||||
|
||||
_pointerId = d3_event.pointerId || 'mouse';
|
||||
|
||||
_target = this;
|
||||
_event = eventOf(_target, arguments);
|
||||
_targetNode = this;
|
||||
|
||||
// only force reflow once per drag
|
||||
var pointerLocGetter = utilFastMouse(_surface || _target.parentNode);
|
||||
var pointerLocGetter = utilFastMouse(_surface || _targetNode.parentNode);
|
||||
|
||||
var offset;
|
||||
var startOrigin = pointerLocGetter(d3_event);
|
||||
@@ -86,7 +75,7 @@ export function behaviorDrag() {
|
||||
.on(_pointerPrefix + 'up.drag pointercancel.drag', pointerup, true);
|
||||
|
||||
if (_origin) {
|
||||
offset = _origin.apply(_target, arguments);
|
||||
offset = _origin.call(_targetNode, _targetEntity);
|
||||
offset = [offset[0] - startOrigin[0], offset[1] - startOrigin[1]];
|
||||
} else {
|
||||
offset = [0, 0];
|
||||
@@ -95,7 +84,7 @@ export function behaviorDrag() {
|
||||
d3_event.stopPropagation();
|
||||
|
||||
|
||||
function pointermove() {
|
||||
function pointermove(d3_event) {
|
||||
if (_pointerId !== (d3_event.pointerId || 'mouse')) return;
|
||||
|
||||
var p = pointerLocGetter(d3_event);
|
||||
@@ -107,7 +96,7 @@ export function behaviorDrag() {
|
||||
if (dist < tolerance) return;
|
||||
|
||||
started = true;
|
||||
_event({ type: 'start' });
|
||||
dispatch.call('start', this, d3_event, _targetEntity);
|
||||
|
||||
// Don't send a `move` event in the same cycle as `start` since dragging
|
||||
// a midpoint will convert the target to a node.
|
||||
@@ -119,22 +108,18 @@ export function behaviorDrag() {
|
||||
|
||||
var dx = p[0] - startOrigin[0];
|
||||
var dy = p[1] - startOrigin[1];
|
||||
_event({
|
||||
type: 'move',
|
||||
point: [p[0] + offset[0], p[1] + offset[1]],
|
||||
delta: [dx, dy]
|
||||
});
|
||||
dispatch.call('move', this, d3_event, _targetEntity, [p[0] + offset[0], p[1] + offset[1]], [dx, dy]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function pointerup() {
|
||||
function pointerup(d3_event) {
|
||||
if (_pointerId !== (d3_event.pointerId || 'mouse')) return;
|
||||
|
||||
_pointerId = null;
|
||||
|
||||
if (started) {
|
||||
_event({ type: 'end' });
|
||||
dispatch.call('end', this, d3_event, _targetEntity);
|
||||
|
||||
d3_event.preventDefault();
|
||||
}
|
||||
@@ -153,17 +138,17 @@ export function behaviorDrag() {
|
||||
var delegate = pointerdown;
|
||||
|
||||
if (_selector) {
|
||||
delegate = function() {
|
||||
delegate = function(d3_event) {
|
||||
var root = this;
|
||||
var target = d3_event.target;
|
||||
for (; target && target !== root; target = target.parentNode) {
|
||||
var datum = target.__data__;
|
||||
|
||||
var entity = datum instanceof osmNote ? datum
|
||||
_targetEntity = datum instanceof osmNote ? datum
|
||||
: datum && datum.properties && datum.properties.entity;
|
||||
|
||||
if (entity && target[matchesSelector](_selector)) {
|
||||
return pointerdown.call(target, entity);
|
||||
if (_targetEntity && target[matchesSelector](_selector)) {
|
||||
return pointerdown.call(target, d3_event);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -202,17 +187,23 @@ export function behaviorDrag() {
|
||||
};
|
||||
|
||||
|
||||
behavior.target = function() {
|
||||
if (!arguments.length) return _target;
|
||||
_target = arguments[0];
|
||||
_event = eventOf(_target, Array.prototype.slice.call(arguments, 1));
|
||||
behavior.targetNode = function(_) {
|
||||
if (!arguments.length) return _targetNode;
|
||||
_targetNode = _;
|
||||
return behavior;
|
||||
};
|
||||
|
||||
|
||||
behavior.surface = function() {
|
||||
behavior.targetEntity = function(_) {
|
||||
if (!arguments.length) return _targetEntity;
|
||||
_targetEntity = _;
|
||||
return behavior;
|
||||
};
|
||||
|
||||
|
||||
behavior.surface = function(_) {
|
||||
if (!arguments.length) return _surface;
|
||||
_surface = arguments[0];
|
||||
_surface = _;
|
||||
return behavior;
|
||||
};
|
||||
|
||||
|
||||
+15
-16
@@ -1,7 +1,6 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -42,7 +41,7 @@ export function behaviorDraw(context) {
|
||||
|
||||
// related code
|
||||
// - `mode/drag_node.js` `datum()`
|
||||
function datum() {
|
||||
function datum(d3_event) {
|
||||
var mode = context.mode();
|
||||
var isNote = mode && (mode.id.indexOf('note') !== -1);
|
||||
if (d3_event.altKey || isNote) return {};
|
||||
@@ -60,7 +59,7 @@ export function behaviorDraw(context) {
|
||||
return (d && d.properties && d.properties.target) ? d : {};
|
||||
}
|
||||
|
||||
function pointerdown() {
|
||||
function pointerdown(d3_event) {
|
||||
|
||||
if (_downPointer) return;
|
||||
|
||||
@@ -72,10 +71,10 @@ export function behaviorDraw(context) {
|
||||
downLoc: pointerLocGetter(d3_event)
|
||||
};
|
||||
|
||||
dispatch.call('down', this, datum());
|
||||
dispatch.call('down', this, datum(d3_event));
|
||||
}
|
||||
|
||||
function pointerup() {
|
||||
function pointerup(d3_event) {
|
||||
|
||||
if (!_downPointer || _downPointer.id !== (d3_event.pointerId || 'mouse')) return;
|
||||
|
||||
@@ -103,11 +102,11 @@ export function behaviorDraw(context) {
|
||||
d3_select(window).on('click.draw-block', null);
|
||||
}, 500);
|
||||
|
||||
click(p2);
|
||||
click(d3_event, p2);
|
||||
}
|
||||
}
|
||||
|
||||
function pointermove() {
|
||||
function pointermove(d3_event) {
|
||||
if (_downPointer &&
|
||||
_downPointer.id === (d3_event.pointerId || 'mouse') &&
|
||||
!_downPointer.isCancelled) {
|
||||
@@ -130,10 +129,10 @@ export function behaviorDraw(context) {
|
||||
d3_event.timeStamp - _lastPointerUpEvent.timeStamp < 100) return;
|
||||
|
||||
_lastMouse = d3_event;
|
||||
dispatch.call('move', this, datum());
|
||||
dispatch.call('move', this, datum(d3_event));
|
||||
}
|
||||
|
||||
function pointercancel() {
|
||||
function pointercancel(d3_event) {
|
||||
if (_downPointer &&
|
||||
_downPointer.id === (d3_event.pointerId || 'mouse')) {
|
||||
|
||||
@@ -160,8 +159,8 @@ export function behaviorDraw(context) {
|
||||
// - `mode/drag_node.js` `doMove()`
|
||||
// - `behavior/draw.js` `click()`
|
||||
// - `behavior/draw_way.js` `move()`
|
||||
function click(loc) {
|
||||
var d = datum();
|
||||
function click(d3_event, loc) {
|
||||
var d = datum(d3_event);
|
||||
var target = d && d.properties && d.properties.entity;
|
||||
|
||||
var mode = context.mode();
|
||||
@@ -187,7 +186,7 @@ export function behaviorDraw(context) {
|
||||
}
|
||||
|
||||
// treat a spacebar press like a click
|
||||
function space() {
|
||||
function space(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
|
||||
@@ -216,23 +215,23 @@ export function behaviorDraw(context) {
|
||||
var loc = context.map().mouse() ||
|
||||
// or the map center if the mouse has never entered the map
|
||||
context.projection(context.map().center());
|
||||
click(loc);
|
||||
click(d3_event, loc);
|
||||
}
|
||||
|
||||
|
||||
function backspace() {
|
||||
function backspace(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
dispatch.call('undo');
|
||||
}
|
||||
|
||||
|
||||
function del() {
|
||||
function del(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
dispatch.call('cancel');
|
||||
}
|
||||
|
||||
|
||||
function ret() {
|
||||
function ret(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
dispatch.call('finish');
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -74,7 +73,7 @@ export function behaviorDrawWay(context, wayID, mode, startGraph) {
|
||||
}
|
||||
|
||||
|
||||
function keydown() {
|
||||
function keydown(d3_event) {
|
||||
if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
|
||||
if (context.surface().classed('nope')) {
|
||||
context.surface()
|
||||
@@ -87,7 +86,7 @@ export function behaviorDrawWay(context, wayID, mode, startGraph) {
|
||||
}
|
||||
|
||||
|
||||
function keyup() {
|
||||
function keyup(d3_event) {
|
||||
if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
|
||||
if (context.surface().classed('nope-suppressed')) {
|
||||
context.surface()
|
||||
@@ -109,7 +108,7 @@ export function behaviorDrawWay(context, wayID, mode, startGraph) {
|
||||
// - `mode/drag_node.js` `doMove()`
|
||||
// - `behavior/draw.js` `click()`
|
||||
// - `behavior/draw_way.js` `move()`
|
||||
function move(datum) {
|
||||
function move(d3_event, datum) {
|
||||
|
||||
var loc = context.map().mouseCoordinates();
|
||||
|
||||
|
||||
+10
-11
@@ -1,7 +1,6 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -31,7 +30,7 @@ export function behaviorHover(context) {
|
||||
var _pointerPrefix = 'PointerEvent' in window ? 'pointer' : 'mouse';
|
||||
|
||||
|
||||
function keydown() {
|
||||
function keydown(d3_event) {
|
||||
if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
|
||||
_selection.selectAll('.hover')
|
||||
.classed('hover-suppressed', true)
|
||||
@@ -45,7 +44,7 @@ export function behaviorHover(context) {
|
||||
}
|
||||
|
||||
|
||||
function keyup() {
|
||||
function keyup(d3_event) {
|
||||
if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
|
||||
_selection.selectAll('.hover-suppressed')
|
||||
.classed('hover-suppressed', false)
|
||||
@@ -83,7 +82,7 @@ export function behaviorHover(context) {
|
||||
.on('keyup.hover', keyup);
|
||||
|
||||
|
||||
function eventTarget() {
|
||||
function eventTarget(d3_event) {
|
||||
var datum = d3_event.target && d3_event.target.__data__;
|
||||
if (typeof datum !== 'object') return null;
|
||||
if (!(datum instanceof osmEntity) && datum.properties && (datum.properties.entity instanceof osmEntity)) {
|
||||
@@ -92,26 +91,26 @@ export function behaviorHover(context) {
|
||||
return datum;
|
||||
}
|
||||
|
||||
function pointerover() {
|
||||
function pointerover(d3_event) {
|
||||
// ignore mouse hovers with buttons pressed unless dragging
|
||||
if (context.mode().id.indexOf('drag') === -1 &&
|
||||
(!d3_event.pointerType || d3_event.pointerType === 'mouse') &&
|
||||
d3_event.buttons) return;
|
||||
|
||||
var target = eventTarget();
|
||||
var target = eventTarget(d3_event);
|
||||
if (target && _targets.indexOf(target) === -1) {
|
||||
_targets.push(target);
|
||||
updateHover(_targets);
|
||||
updateHover(d3_event, _targets);
|
||||
}
|
||||
}
|
||||
|
||||
function pointerout() {
|
||||
function pointerout(d3_event) {
|
||||
|
||||
var target = eventTarget();
|
||||
var target = eventTarget(d3_event);
|
||||
var index = _targets.indexOf(target);
|
||||
if (index !== -1) {
|
||||
_targets.splice(index);
|
||||
updateHover(_targets);
|
||||
updateHover(d3_event, _targets);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +127,7 @@ export function behaviorHover(context) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function updateHover(targets) {
|
||||
function updateHover(d3_event, targets) {
|
||||
|
||||
_selection.selectAll('.hover')
|
||||
.classed('hover', false);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { geoExtent, geoPointInPolygon } from '../geo';
|
||||
import { modeSelect } from '../modes/select';
|
||||
@@ -16,7 +16,7 @@ export function behaviorLasso(context) {
|
||||
var lasso;
|
||||
|
||||
|
||||
function pointerdown() {
|
||||
function pointerdown(d3_event) {
|
||||
var button = 0; // left
|
||||
if (d3_event.button === button && d3_event.shiftKey === true) {
|
||||
lasso = null;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
|
||||
|
||||
/* Creates a keybinding behavior for an operation */
|
||||
export function behaviorOperation(context) {
|
||||
var _operation;
|
||||
|
||||
function keypress() {
|
||||
function keypress(d3_event) {
|
||||
// prevent operations during low zoom selection
|
||||
if (!context.map().withinEditableZoom()) return;
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
|
||||
import { actionCopyEntities } from '../actions/copy_entities';
|
||||
import { actionMove } from '../actions/move';
|
||||
import { geoExtent, geoPointInPolygon, geoVecSubtract } from '../geo';
|
||||
@@ -9,7 +7,7 @@ import { uiCmd } from '../ui/cmd';
|
||||
// see also `operationPaste`
|
||||
export function behaviorPaste(context) {
|
||||
|
||||
function doPaste() {
|
||||
function doPaste(d3_event) {
|
||||
// prevent paste during low zoom selection
|
||||
if (!context.map().withinEditableZoom()) return;
|
||||
|
||||
|
||||
+12
-12
@@ -1,4 +1,4 @@
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { geoVecLength } from '../geo';
|
||||
import { modeBrowse } from '../modes/browse';
|
||||
@@ -24,7 +24,7 @@ export function behaviorSelect(context) {
|
||||
var _pointerPrefix = 'PointerEvent' in window ? 'pointer' : 'mouse';
|
||||
|
||||
|
||||
function keydown() {
|
||||
function keydown(d3_event) {
|
||||
|
||||
if (d3_event.keyCode === 32) {
|
||||
// don't react to spacebar events during text input
|
||||
@@ -61,7 +61,7 @@ export function behaviorSelect(context) {
|
||||
}
|
||||
|
||||
|
||||
function keyup() {
|
||||
function keyup(d3_event) {
|
||||
cancelLongPress();
|
||||
|
||||
if (!d3_event.shiftKey) {
|
||||
@@ -88,7 +88,7 @@ export function behaviorSelect(context) {
|
||||
}
|
||||
|
||||
|
||||
function pointerdown() {
|
||||
function pointerdown(d3_event) {
|
||||
var id = (d3_event.pointerId || 'mouse').toString();
|
||||
|
||||
cancelLongPress();
|
||||
@@ -124,7 +124,7 @@ export function behaviorSelect(context) {
|
||||
}
|
||||
|
||||
|
||||
function pointermove() {
|
||||
function pointermove(d3_event) {
|
||||
var id = (d3_event.pointerId || 'mouse').toString();
|
||||
if (_downPointers[id]) {
|
||||
_downPointers[id].lastEvent = d3_event;
|
||||
@@ -138,7 +138,7 @@ export function behaviorSelect(context) {
|
||||
}
|
||||
|
||||
|
||||
function pointerup() {
|
||||
function pointerup(d3_event) {
|
||||
var id = (d3_event.pointerId || 'mouse').toString();
|
||||
var pointer = _downPointers[id];
|
||||
if (!pointer) return;
|
||||
@@ -155,7 +155,7 @@ export function behaviorSelect(context) {
|
||||
}
|
||||
|
||||
|
||||
function pointercancel() {
|
||||
function pointercancel(d3_event) {
|
||||
var id = (d3_event.pointerId || 'mouse').toString();
|
||||
if (!_downPointers[id]) return;
|
||||
|
||||
@@ -167,7 +167,7 @@ export function behaviorSelect(context) {
|
||||
}
|
||||
|
||||
|
||||
function contextmenu() {
|
||||
function contextmenu(d3_event) {
|
||||
var e = d3_event;
|
||||
e.preventDefault();
|
||||
|
||||
@@ -226,7 +226,7 @@ export function behaviorSelect(context) {
|
||||
// support multiselect if data is already selected
|
||||
var isMultiselect = context.mode().id === 'select' && (
|
||||
// and shift key is down
|
||||
(d3_event && d3_event.shiftKey) ||
|
||||
(lastEvent && lastEvent.shiftKey) ||
|
||||
// or we're lasso-selecting
|
||||
context.surface().select('.lasso').node() ||
|
||||
// or a pointer is down over a selected feature
|
||||
@@ -382,7 +382,7 @@ export function behaviorSelect(context) {
|
||||
.on(_pointerPrefix + 'move.select', pointermove, true)
|
||||
.on(_pointerPrefix + 'up.select', pointerup, true)
|
||||
.on('pointercancel.select', pointercancel, true)
|
||||
.on('contextmenu.select-window', function() {
|
||||
.on('contextmenu.select-window', function(d3_event) {
|
||||
// Edge and IE really like to show the contextmenu on the
|
||||
// menubar when user presses a keyboard menu button
|
||||
// even after we've already preventdefaulted the key event.
|
||||
@@ -396,10 +396,10 @@ export function behaviorSelect(context) {
|
||||
.on(_pointerPrefix + 'down.select', pointerdown)
|
||||
.on('contextmenu.select', contextmenu);
|
||||
|
||||
if (d3_event && d3_event.shiftKey) {
|
||||
/*if (d3_event && d3_event.shiftKey) {
|
||||
context.surface()
|
||||
.classed('behavior-multiselect', true);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,9 +26,7 @@ export let debug = false;
|
||||
// Reexport just what our tests use, see #4379
|
||||
import * as D3 from 'd3';
|
||||
export let d3 = {
|
||||
customEvent: D3.customEvent,
|
||||
dispatch: D3.dispatch,
|
||||
event: D3.event,
|
||||
geoMercator: D3.geoMercator,
|
||||
geoProjection: D3.geoProjection,
|
||||
polygonArea: D3.polygonArea,
|
||||
@@ -37,4 +35,3 @@ export let d3 = {
|
||||
selectAll: D3.selectAll,
|
||||
timerFlush: D3.timerFlush
|
||||
};
|
||||
|
||||
|
||||
+22
-23
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -48,11 +47,11 @@ export function modeDragNode(context) {
|
||||
var _lastLoc;
|
||||
|
||||
|
||||
function startNudge(entity, nudge) {
|
||||
function startNudge(d3_event, entity, nudge) {
|
||||
if (_nudgeInterval) window.clearInterval(_nudgeInterval);
|
||||
_nudgeInterval = window.setInterval(function() {
|
||||
context.map().pan(nudge);
|
||||
doMove(entity, nudge);
|
||||
doMove(d3_event, entity, nudge);
|
||||
}, 50);
|
||||
}
|
||||
|
||||
@@ -102,7 +101,7 @@ export function modeDragNode(context) {
|
||||
}
|
||||
|
||||
|
||||
function keydown() {
|
||||
function keydown(d3_event) {
|
||||
if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
|
||||
if (context.surface().classed('nope')) {
|
||||
context.surface()
|
||||
@@ -115,7 +114,7 @@ export function modeDragNode(context) {
|
||||
}
|
||||
|
||||
|
||||
function keyup() {
|
||||
function keyup(d3_event) {
|
||||
if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
|
||||
if (context.surface().classed('nope-suppressed')) {
|
||||
context.surface()
|
||||
@@ -128,10 +127,10 @@ export function modeDragNode(context) {
|
||||
}
|
||||
|
||||
|
||||
function start(entity) {
|
||||
function start(d3_event, entity) {
|
||||
_wasMidpoint = entity.type === 'midpoint';
|
||||
var hasHidden = context.features().hasHiddenConnections(entity, context.graph());
|
||||
_isCancelled = !context.editable() || d3_event.sourceEvent.shiftKey || hasHidden;
|
||||
_isCancelled = !context.editable() || d3_event.shiftKey || hasHidden;
|
||||
|
||||
|
||||
if (_isCancelled) {
|
||||
@@ -151,7 +150,8 @@ export function modeDragNode(context) {
|
||||
entity = context.entity(entity.id); // get post-action entity
|
||||
|
||||
var vertex = context.surface().selectAll('.' + entity.id);
|
||||
drag.target(vertex.node(), entity);
|
||||
drag.targetNode(vertex.node())
|
||||
.targetEntity(entity);
|
||||
|
||||
} else {
|
||||
context.perform(actionNoop());
|
||||
@@ -171,20 +171,19 @@ export function modeDragNode(context) {
|
||||
|
||||
// related code
|
||||
// - `behavior/draw.js` `datum()`
|
||||
function datum() {
|
||||
var event = d3_event && d3_event.sourceEvent;
|
||||
if (!event || event.altKey) {
|
||||
function datum(d3_event) {
|
||||
if (!d3_event || d3_event.altKey) {
|
||||
return {};
|
||||
} else {
|
||||
// When dragging, snap only to touch targets..
|
||||
// (this excludes area fills and active drawing elements)
|
||||
var d = event.target.__data__;
|
||||
var d = d3_event.target.__data__;
|
||||
return (d && d.properties && d.properties.target) ? d : {};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function doMove(entity, nudge) {
|
||||
function doMove(d3_event, entity, nudge) {
|
||||
nudge = nudge || [0, 0];
|
||||
|
||||
var currPoint = (d3_event && d3_event.point) || context.projection(_lastLoc);
|
||||
@@ -196,7 +195,7 @@ export function modeDragNode(context) {
|
||||
// - `mode/drag_node.js` `doMove()`
|
||||
// - `behavior/draw.js` `click()`
|
||||
// - `behavior/draw_way.js` `move()`
|
||||
var d = datum();
|
||||
var d = datum(d3_event);
|
||||
var target = d && d.properties && d.properties.entity;
|
||||
var targetLoc = target && target.loc;
|
||||
var targetNodes = d && d.properties && d.properties.nodes;
|
||||
@@ -350,29 +349,29 @@ export function modeDragNode(context) {
|
||||
}
|
||||
|
||||
|
||||
function move(entity) {
|
||||
function move(d3_event, entity, point) {
|
||||
if (_isCancelled) return;
|
||||
d3_event.sourceEvent.stopPropagation();
|
||||
d3_event.stopPropagation();
|
||||
|
||||
context.surface().classed('nope-disabled', d3_event.sourceEvent.altKey);
|
||||
context.surface().classed('nope-disabled', d3_event.altKey);
|
||||
|
||||
_lastLoc = context.projection.invert(d3_event.point);
|
||||
_lastLoc = context.projection.invert(point);
|
||||
|
||||
doMove(entity);
|
||||
var nudge = geoViewportEdge(d3_event.point, context.map().dimensions());
|
||||
doMove(d3_event, entity);
|
||||
var nudge = geoViewportEdge(point, context.map().dimensions());
|
||||
if (nudge) {
|
||||
startNudge(entity, nudge);
|
||||
startNudge(d3_event, entity, nudge);
|
||||
} else {
|
||||
stopNudge();
|
||||
}
|
||||
}
|
||||
|
||||
function end(entity) {
|
||||
function end(d3_event, entity) {
|
||||
if (_isCancelled) return;
|
||||
|
||||
var wasPoint = entity.geometry(context.graph()) === 'point';
|
||||
|
||||
var d = datum();
|
||||
var d = datum(d3_event);
|
||||
var nope = (d && d.properties && d.properties.nope) || context.surface().classed('nope');
|
||||
var target = d && d.properties && d.properties.entity; // entity to snap to
|
||||
|
||||
|
||||
+10
-13
@@ -1,6 +1,3 @@
|
||||
import {
|
||||
event as d3_event
|
||||
} from 'd3-selection';
|
||||
|
||||
import { services } from '../services';
|
||||
import { actionNoop } from '../actions/noop';
|
||||
@@ -23,11 +20,11 @@ export function modeDragNote(context) {
|
||||
var _note; // most current note.. dragged note may have stale datum.
|
||||
|
||||
|
||||
function startNudge(nudge) {
|
||||
function startNudge(d3_event, nudge) {
|
||||
if (_nudgeInterval) window.clearInterval(_nudgeInterval);
|
||||
_nudgeInterval = window.setInterval(function() {
|
||||
context.map().pan(nudge);
|
||||
doMove(nudge);
|
||||
doMove(d3_event, nudge);
|
||||
}, 50);
|
||||
}
|
||||
|
||||
@@ -45,7 +42,7 @@ export function modeDragNote(context) {
|
||||
}
|
||||
|
||||
|
||||
function start(note) {
|
||||
function start(d3_event, note) {
|
||||
_note = note;
|
||||
var osm = services.osm;
|
||||
if (osm) {
|
||||
@@ -63,21 +60,21 @@ export function modeDragNote(context) {
|
||||
}
|
||||
|
||||
|
||||
function move() {
|
||||
d3_event.sourceEvent.stopPropagation();
|
||||
_lastLoc = context.projection.invert(d3_event.point);
|
||||
function move(d3_event, entity, point) {
|
||||
d3_event.stopPropagation();
|
||||
_lastLoc = context.projection.invert(point);
|
||||
|
||||
doMove();
|
||||
var nudge = geoViewportEdge(d3_event.point, context.map().dimensions());
|
||||
doMove(d3_event);
|
||||
var nudge = geoViewportEdge(point, context.map().dimensions());
|
||||
if (nudge) {
|
||||
startNudge(nudge);
|
||||
startNudge(d3_event, nudge);
|
||||
} else {
|
||||
stopNudge();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function doMove(nudge) {
|
||||
function doMove(d3_event, nudge) {
|
||||
nudge = nudge || [0, 0];
|
||||
|
||||
var currPoint = (d3_event && d3_event.point) || context.projection(_lastLoc);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -96,7 +95,7 @@ export function modeMove(context, entityIDs, baseGraph) {
|
||||
}
|
||||
|
||||
|
||||
function finish() {
|
||||
function finish(d3_event) {
|
||||
d3_event.stopPropagation();
|
||||
context.replace(actionNoop(), annotation);
|
||||
context.enter(modeSelect(context, entityIDs));
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -105,7 +104,7 @@ export function modeRotate(context, entityIDs) {
|
||||
}
|
||||
|
||||
|
||||
function finish() {
|
||||
function finish(d3_event) {
|
||||
d3_event.stopPropagation();
|
||||
context.replace(actionNoop(), annotation);
|
||||
context.enter(modeSelect(context, entityIDs));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
import { t } from '../core/localizer';
|
||||
|
||||
import { modeBrowse } from './browse';
|
||||
@@ -123,7 +123,7 @@ export function modeSave(context) {
|
||||
.attr('href', '#')
|
||||
.classed('hide-toggle', true)
|
||||
.text(function(d) { return d.msg || t('save.unknown_error_details'); })
|
||||
.on('click', function() {
|
||||
.on('click', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
|
||||
var error = d3_select(this);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { t } from '../core/localizer';
|
||||
|
||||
@@ -385,7 +385,7 @@ export function modeSelect(context, selectedIDs) {
|
||||
}
|
||||
|
||||
|
||||
function didDoubleUp(loc) {
|
||||
function didDoubleUp(d3_event, loc) {
|
||||
if (!context.map().withinEditableZoom()) return;
|
||||
|
||||
var target = d3_select(d3_event.target);
|
||||
@@ -452,7 +452,7 @@ export function modeSelect(context, selectedIDs) {
|
||||
}
|
||||
|
||||
|
||||
function firstVertex() {
|
||||
function firstVertex(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
var entity = singular();
|
||||
var parent = singularParent();
|
||||
@@ -472,7 +472,7 @@ export function modeSelect(context, selectedIDs) {
|
||||
}
|
||||
|
||||
|
||||
function lastVertex() {
|
||||
function lastVertex(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
var entity = singular();
|
||||
var parent = singularParent();
|
||||
@@ -492,7 +492,7 @@ export function modeSelect(context, selectedIDs) {
|
||||
}
|
||||
|
||||
|
||||
function previousVertex() {
|
||||
function previousVertex(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
var parent = singularParent();
|
||||
if (!parent) return;
|
||||
@@ -516,7 +516,7 @@ export function modeSelect(context, selectedIDs) {
|
||||
}
|
||||
|
||||
|
||||
function nextVertex() {
|
||||
function nextVertex(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
var parent = singularParent();
|
||||
if (!parent) return;
|
||||
@@ -540,7 +540,7 @@ export function modeSelect(context, selectedIDs) {
|
||||
}
|
||||
|
||||
|
||||
function nextParent() {
|
||||
function nextParent(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
var parents = commonParents();
|
||||
if (!parents || parents.length < 2) return;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { geoBounds as d3_geoBounds } from 'd3-geo';
|
||||
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -40,7 +39,7 @@ export function modeSelectData(context, selectedDatum) {
|
||||
|
||||
|
||||
// class the data as selected, or return to browse mode if the data is gone
|
||||
function selectData(drawn) {
|
||||
function selectData(d3_event, drawn) {
|
||||
var selection = context.surface().selectAll('.layer-mapdata .data' + selectedDatum.__featurehash__);
|
||||
|
||||
if (selection.empty()) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -114,7 +113,7 @@ export function modeSelectError(context, selectedErrorID, selectedErrorService)
|
||||
|
||||
|
||||
// class the error as selected, or return to browse mode if the error is gone
|
||||
function selectError(drawn) {
|
||||
function selectError(d3_event, drawn) {
|
||||
if (!checkSelectedID()) return;
|
||||
|
||||
var selection = context.surface()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -57,7 +56,7 @@ export function modeSelectNote(context, selectedNoteID) {
|
||||
|
||||
|
||||
// class the note as selected, or return to browse mode if the note is gone
|
||||
function selectNote(drawn) {
|
||||
function selectNote(d3_event, drawn) {
|
||||
if (!checkSelectedID()) return;
|
||||
|
||||
var selection = context.surface().selectAll('.layer-notes .note-' + selectedNoteID);
|
||||
|
||||
+18
-18
@@ -3,7 +3,7 @@ import _throttle from 'lodash-es/throttle';
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { interpolate as d3_interpolate } from 'd3-interpolate';
|
||||
import { scaleLinear as d3_scaleLinear } from 'd3-scale';
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
import { zoom as d3_zoom, zoomIdentity as d3_zoomIdentity } from 'd3-zoom';
|
||||
|
||||
import { prefs } from '../core/preferences';
|
||||
@@ -77,8 +77,9 @@ export function rendererMap(context) {
|
||||
.interpolate(d3_interpolate)
|
||||
.filter(zoomEventFilter)
|
||||
.on('zoom.map', zoomPan)
|
||||
.on('start.map', function() {
|
||||
_pointerDown = d3_event.sourceEvent && d3_event.sourceEvent.type === 'pointerdown';
|
||||
.on('start.map', function(d3_event) {
|
||||
_pointerDown = d3_event && (d3_event.type === 'pointerdown' ||
|
||||
(d3_event.sourceEvent && d3_event.sourceEvent.type === 'pointerdown'));
|
||||
})
|
||||
.on('end.map', function() {
|
||||
_pointerDown = false;
|
||||
@@ -150,7 +151,7 @@ export function rendererMap(context) {
|
||||
});
|
||||
|
||||
selection
|
||||
.on('wheel.map mousewheel.map', function() {
|
||||
.on('wheel.map mousewheel.map', function(d3_event) {
|
||||
// disable swipe-to-navigate browser pages on trackpad/magic mouse – #5552
|
||||
d3_event.preventDefault();
|
||||
})
|
||||
@@ -175,29 +176,29 @@ export function rendererMap(context) {
|
||||
surface
|
||||
.call(drawLabels.observe)
|
||||
.call(_doubleUpHandler)
|
||||
.on(_pointerPrefix + 'down.zoom', function() {
|
||||
.on(_pointerPrefix + 'down.zoom', function(d3_event) {
|
||||
_lastPointerEvent = d3_event;
|
||||
if (d3_event.button === 2) {
|
||||
d3_event.stopPropagation();
|
||||
}
|
||||
}, true)
|
||||
.on(_pointerPrefix + 'up.zoom', function() {
|
||||
.on(_pointerPrefix + 'up.zoom', function(d3_event) {
|
||||
_lastPointerEvent = d3_event;
|
||||
if (resetTransform()) {
|
||||
immediateRedraw();
|
||||
}
|
||||
})
|
||||
.on(_pointerPrefix + 'move.map', function() {
|
||||
.on(_pointerPrefix + 'move.map', function(d3_event) {
|
||||
_lastPointerEvent = d3_event;
|
||||
})
|
||||
.on(_pointerPrefix + 'over.vertices', function() {
|
||||
.on(_pointerPrefix + 'over.vertices', function(d3_event) {
|
||||
if (map.editableDataEnabled() && !_isTransformed) {
|
||||
var hover = d3_event.target.__data__;
|
||||
surface.call(drawVertices.drawHover, context.graph(), hover, map.extent());
|
||||
dispatch.call('drawn', this, { full: false });
|
||||
}
|
||||
})
|
||||
.on(_pointerPrefix + 'out.vertices', function() {
|
||||
.on(_pointerPrefix + 'out.vertices', function(d3_event) {
|
||||
if (map.editableDataEnabled() && !_isTransformed) {
|
||||
var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
|
||||
surface.call(drawVertices.drawHover, context.graph(), hover, map.extent());
|
||||
@@ -216,7 +217,7 @@ export function rendererMap(context) {
|
||||
// Desktop Safari sends gesture events for multitouch trackpad pinches.
|
||||
// We can listen for these and translate them into map zooms.
|
||||
surface
|
||||
.on('gesturestart.surface', function() {
|
||||
.on('gesturestart.surface', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
_gestureTransformStart = projection.transform();
|
||||
})
|
||||
@@ -226,7 +227,7 @@ export function rendererMap(context) {
|
||||
// must call after surface init
|
||||
updateAreaFill();
|
||||
|
||||
_doubleUpHandler.on('doubleUp.map', function(p0) {
|
||||
_doubleUpHandler.on('doubleUp.map', function(d3_event, p0) {
|
||||
if (!_dblClickZoomEnabled) return;
|
||||
|
||||
// don't zoom if targeting something other than the map itself
|
||||
@@ -286,7 +287,7 @@ export function rendererMap(context) {
|
||||
}
|
||||
|
||||
|
||||
function zoomEventFilter() {
|
||||
function zoomEventFilter(d3_event) {
|
||||
// Fix for #2151, (see also d3/d3-zoom#60, d3/d3-brush#18)
|
||||
// Intercept `mousedown` and check if there is an orphaned zoom gesture.
|
||||
// This can happen if a previous `mousedown` occurred without a `mouseup`.
|
||||
@@ -431,7 +432,7 @@ export function rendererMap(context) {
|
||||
|
||||
|
||||
|
||||
function gestureChange() {
|
||||
function gestureChange(d3_event) {
|
||||
// Remap Safari gesture events to wheel events - #5492
|
||||
// We want these disabled most places, but enabled for zoom/unzoom on map surface
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/GestureEvent
|
||||
@@ -457,10 +458,9 @@ export function rendererMap(context) {
|
||||
}
|
||||
|
||||
|
||||
function zoomPan(manualEvent) {
|
||||
var event = (manualEvent || d3_event);
|
||||
var source = event.sourceEvent;
|
||||
var eventTransform = event.transform;
|
||||
function zoomPan(event, key, transform) {
|
||||
var source = event && event.sourceEvent || event;
|
||||
var eventTransform = transform || (event && event.transform);
|
||||
var x = eventTransform.x;
|
||||
var y = eventTransform.y;
|
||||
var k = eventTransform.k;
|
||||
@@ -709,7 +709,7 @@ export function rendererMap(context) {
|
||||
};
|
||||
|
||||
|
||||
map.mouse = function() {
|
||||
map.mouse = function(d3_event) {
|
||||
var event = _lastPointerEvent || d3_event;
|
||||
if (event) {
|
||||
var s;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { json as d3_json } from 'd3-fetch';
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
import { zoom as d3_zoom, zoomIdentity as d3_zoomIdentity } from 'd3-zoom';
|
||||
|
||||
import RBush from 'rbush';
|
||||
@@ -304,7 +303,7 @@ export default {
|
||||
});
|
||||
|
||||
|
||||
function zoomPan() {
|
||||
function zoomPan(d3_event) {
|
||||
var t = d3_event.transform;
|
||||
context.container().select('.photoviewer .osc-image-wrap')
|
||||
.call(utilSetTransform, t.x, t.y, t.k);
|
||||
|
||||
@@ -2,7 +2,6 @@ import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { timer as d3_timer } from 'd3-timer';
|
||||
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -766,7 +765,7 @@ export default {
|
||||
.attr('type', 'checkbox')
|
||||
.attr('id', hiresDomId)
|
||||
.property('checked', _hires)
|
||||
.on('click', () => {
|
||||
.on('click', (d3_event) => {
|
||||
d3_event.stopPropagation();
|
||||
|
||||
_hires = !_hires;
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@ import _throttle from 'lodash-es/throttle';
|
||||
|
||||
import { geoBounds as d3_geoBounds, geoPath as d3_geoPath } from 'd3-geo';
|
||||
import { text as d3_text } from 'd3-fetch';
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import stringify from 'fast-json-stable-stringify';
|
||||
import toGeoJSON from '@mapbox/togeojson';
|
||||
@@ -36,7 +36,7 @@ export function svgData(projection, context, dispatch) {
|
||||
_geojson = {};
|
||||
_enabled = true;
|
||||
|
||||
function over() {
|
||||
function over(d3_event) {
|
||||
d3_event.stopPropagation();
|
||||
d3_event.preventDefault();
|
||||
d3_event.dataTransfer.dropEffect = 'copy';
|
||||
@@ -44,7 +44,7 @@ export function svgData(projection, context, dispatch) {
|
||||
|
||||
context.container()
|
||||
.attr('dropzone', 'copy')
|
||||
.on('drop.svgData', function() {
|
||||
.on('drop.svgData', function(d3_event) {
|
||||
d3_event.stopPropagation();
|
||||
d3_event.preventDefault();
|
||||
if (!detected.filedrop) return;
|
||||
|
||||
@@ -71,7 +71,7 @@ export function svgMapillaryImages(projection, context, dispatch) {
|
||||
}
|
||||
|
||||
|
||||
function click(d) {
|
||||
function click(d3_event, d) {
|
||||
var service = getService();
|
||||
if (!service) return;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ export function svgMapillaryMapFeatures(projection, context, dispatch) {
|
||||
}
|
||||
|
||||
|
||||
function click(d) {
|
||||
function click(d3_event, d) {
|
||||
var service = getService();
|
||||
if (!service) return;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ export function svgMapillarySigns(projection, context, dispatch) {
|
||||
}
|
||||
|
||||
|
||||
function click(d) {
|
||||
function click(d3_event, d) {
|
||||
var service = getService();
|
||||
if (!service) return;
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ export function svgOpenstreetcamImages(projection, context, dispatch) {
|
||||
}
|
||||
|
||||
|
||||
function click(d) {
|
||||
function click(d3_event, d) {
|
||||
var service = getService();
|
||||
if (!service) return;
|
||||
|
||||
@@ -84,7 +84,7 @@ export function svgOpenstreetcamImages(projection, context, dispatch) {
|
||||
}
|
||||
|
||||
|
||||
function mouseover(d) {
|
||||
function mouseover(d3_event, d) {
|
||||
var service = getService();
|
||||
if (service) service.setStyles(context, d);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ export function svgStreetside(projection, context, dispatch) {
|
||||
/**
|
||||
* click() Handles 'bubble' point click event.
|
||||
*/
|
||||
function click(d) {
|
||||
function click(d3_event, d) {
|
||||
var service = getService();
|
||||
if (!service) return;
|
||||
|
||||
@@ -112,7 +112,7 @@ export function svgStreetside(projection, context, dispatch) {
|
||||
/**
|
||||
* mouseover().
|
||||
*/
|
||||
function mouseover(d) {
|
||||
function mouseover(d3_event, d) {
|
||||
var service = getService();
|
||||
if (service) service.setStyles(context, d);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
|
||||
import { t } from '../core/localizer';
|
||||
import { svgIcon } from '../svg/icon';
|
||||
|
||||
|
||||
export function uiAccount(context) {
|
||||
var osm = context.connection();
|
||||
|
||||
@@ -53,7 +50,7 @@ export function uiAccount(context) {
|
||||
.attr('class', 'logout')
|
||||
.attr('href', '#')
|
||||
.html(t.html('logout'))
|
||||
.on('click.logout', function() {
|
||||
.on('click.logout', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
osm.logout();
|
||||
});
|
||||
|
||||
+13
-13
@@ -1,5 +1,5 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
import { utilGetSetValue, utilRebind, utilTriggerEvent } from '../util';
|
||||
|
||||
|
||||
@@ -63,19 +63,19 @@ export function uiCombobox(context, klass) {
|
||||
.enter()
|
||||
.insert('div', function() { return sibling; })
|
||||
.attr('class', 'combobox-caret')
|
||||
.on('mousedown.combo-caret', function() {
|
||||
.on('mousedown.combo-caret', function(d3_event) {
|
||||
d3_event.preventDefault(); // don't steal focus from input
|
||||
input.node().focus(); // focus the input as if it was clicked
|
||||
mousedown();
|
||||
mousedown(d3_event);
|
||||
})
|
||||
.on('mouseup.combo-caret', function() {
|
||||
.on('mouseup.combo-caret', function(d3_event) {
|
||||
d3_event.preventDefault(); // don't steal focus from input
|
||||
mouseup();
|
||||
mouseup(d3_event);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function mousedown() {
|
||||
function mousedown(d3_event) {
|
||||
if (d3_event.button !== 0) return; // left click only
|
||||
_tDown = +new Date();
|
||||
|
||||
@@ -92,7 +92,7 @@ export function uiCombobox(context, klass) {
|
||||
}
|
||||
|
||||
|
||||
function mouseup() {
|
||||
function mouseup(d3_event) {
|
||||
input.on('mouseup.combo-input', null);
|
||||
if (d3_event.button !== 0) return; // left click only
|
||||
if (input.node() !== document.activeElement) return; // exit if this input is not focused
|
||||
@@ -139,7 +139,7 @@ export function uiCombobox(context, klass) {
|
||||
.style('position', 'absolute')
|
||||
.style('display', 'block')
|
||||
.style('left', '0px')
|
||||
.on('mousedown.combo-container', function () {
|
||||
.on('mousedown.combo-container', function (d3_event) {
|
||||
// prevent moving focus out of the input field
|
||||
d3_event.preventDefault();
|
||||
});
|
||||
@@ -163,7 +163,7 @@ export function uiCombobox(context, klass) {
|
||||
}
|
||||
|
||||
|
||||
function keydown() {
|
||||
function keydown(d3_event) {
|
||||
var shown = !container.selectAll('.combobox').empty();
|
||||
var tagName = input.node() ? input.node().tagName.toLowerCase() : '';
|
||||
|
||||
@@ -181,7 +181,7 @@ export function uiCombobox(context, klass) {
|
||||
break;
|
||||
|
||||
case 9: // ⇥ Tab
|
||||
accept();
|
||||
accept(d3_event);
|
||||
break;
|
||||
|
||||
case 13: // ↩ Return
|
||||
@@ -210,14 +210,14 @@ export function uiCombobox(context, klass) {
|
||||
}
|
||||
|
||||
|
||||
function keyup() {
|
||||
function keyup(d3_event) {
|
||||
switch (d3_event.keyCode) {
|
||||
case 27: // ⎋ Escape
|
||||
cancel();
|
||||
break;
|
||||
|
||||
case 13: // ↩ Return
|
||||
accept();
|
||||
accept(d3_event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -403,7 +403,7 @@ export function uiCombobox(context, klass) {
|
||||
|
||||
// Dispatches an 'accept' event
|
||||
// Then hides the combobox.
|
||||
function accept(d) {
|
||||
function accept(d3_event, d) {
|
||||
_cancelFetch = true;
|
||||
var thiz = input.node();
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -184,7 +183,7 @@ export function uiConflicts(context) {
|
||||
.attr('class', 'conflict-description')
|
||||
.attr('href', '#')
|
||||
.html(function(d) { return d.name; })
|
||||
.on('click', function(d) {
|
||||
.on('click', function(d3_event, d) {
|
||||
d3_event.preventDefault();
|
||||
zoomToEntity(d.id);
|
||||
});
|
||||
@@ -221,7 +220,7 @@ export function uiConflicts(context) {
|
||||
return (i === 0 && index === 0) ||
|
||||
(i === 1 && index === _conflictList.length - 1) || null;
|
||||
})
|
||||
.on('click', function(d, i) {
|
||||
.on('click', function(d3_event, d, i) {
|
||||
d3_event.preventDefault();
|
||||
|
||||
var container = parent.selectAll('.conflict-container');
|
||||
@@ -257,10 +256,10 @@ export function uiConflicts(context) {
|
||||
.append('input')
|
||||
.attr('type', 'radio')
|
||||
.attr('name', function(d) { return d.id; })
|
||||
.on('change', function(d, i) {
|
||||
.on('change', function(d3_event, d, i) {
|
||||
var ul = this.parentNode.parentNode.parentNode;
|
||||
ul.__data__.chosen = i;
|
||||
choose(ul, d);
|
||||
choose(d3_event, ul, d);
|
||||
});
|
||||
|
||||
labelEnter
|
||||
@@ -273,13 +272,13 @@ export function uiConflicts(context) {
|
||||
.each(function(d, i) {
|
||||
var ul = this.parentNode;
|
||||
if (ul.__data__.chosen === i) {
|
||||
choose(ul, d);
|
||||
choose(null, ul, d);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function choose(ul, datum) {
|
||||
function choose(d3_event, ul, datum) {
|
||||
if (d3_event) d3_event.preventDefault();
|
||||
|
||||
d3_select(ul)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { easeLinear as d3_easeLinear } from 'd3-ease';
|
||||
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -126,7 +125,7 @@ export function uiCurtain(containerNode) {
|
||||
if (options.buttonText && options.buttonCallback) {
|
||||
var button = tooltip.selectAll('.button-section .button.action');
|
||||
button
|
||||
.on('click', function() {
|
||||
.on('click', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
options.buttonCallback();
|
||||
});
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
|
||||
import { prefs } from '../core/preferences';
|
||||
import { svgIcon } from '../svg/icon';
|
||||
@@ -73,7 +72,7 @@ export function uiDisclosure(context, key, expandedDefault) {
|
||||
}
|
||||
|
||||
|
||||
function toggle() {
|
||||
function toggle(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
|
||||
_expanded = !_expanded;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
|
||||
import { geoVecAdd } from '../geo';
|
||||
@@ -87,16 +87,16 @@ export function uiEditMenu(context) {
|
||||
.on('click', click)
|
||||
// don't listen for `mouseup` because we only care about non-mouse pointer types
|
||||
.on('pointerup', pointerup)
|
||||
.on('pointerdown mousedown', function pointerdown() {
|
||||
.on('pointerdown mousedown', function pointerdown(d3_event) {
|
||||
// don't let button presses also act as map input - #1869
|
||||
d3_event.stopPropagation();
|
||||
})
|
||||
.on('mouseenter.highlight', function(d) {
|
||||
.on('mouseenter.highlight', function(d3_event, d) {
|
||||
if (!d.relatedEntityIds || d3_select(this).classed('disabled')) return;
|
||||
|
||||
utilHighlightEntities(d.relatedEntityIds(), true, context);
|
||||
})
|
||||
.on('mouseleave.highlight', function(d) {
|
||||
.on('mouseleave.highlight', function(d3_event, d) {
|
||||
if (!d.relatedEntityIds) return;
|
||||
|
||||
utilHighlightEntities(d.relatedEntityIds(), false, context);
|
||||
@@ -145,11 +145,11 @@ export function uiEditMenu(context) {
|
||||
|
||||
var lastPointerUpType;
|
||||
// `pointerup` is always called before `click`
|
||||
function pointerup() {
|
||||
function pointerup(d3_event) {
|
||||
lastPointerUpType = d3_event.pointerType;
|
||||
}
|
||||
|
||||
function click(operation) {
|
||||
function click(d3_event, operation) {
|
||||
d3_event.stopPropagation();
|
||||
|
||||
if (operation.relatedEntityIds) {
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
|
||||
import { t } from '../core/localizer';
|
||||
import { uiTooltip } from './tooltip';
|
||||
|
||||
|
||||
export function uiFeatureInfo(context) {
|
||||
function update(selection) {
|
||||
var features = context.features();
|
||||
@@ -30,7 +27,7 @@ export function uiFeatureInfo(context) {
|
||||
.attr('href', '#')
|
||||
.html(t.html('feature_info.hidden_warning', { count: count }))
|
||||
.call(tooltipBehavior)
|
||||
.on('click', function() {
|
||||
.on('click', function(d3_event) {
|
||||
tooltipBehavior.hide();
|
||||
d3_event.preventDefault();
|
||||
// open the Map Data pane
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
import * as sexagesimal from '@mapbox/sexagesimal';
|
||||
@@ -70,7 +69,7 @@ export function uiFeatureList(context) {
|
||||
.on(uiCmd('⌘F'), focusSearch);
|
||||
|
||||
|
||||
function focusSearch() {
|
||||
function focusSearch(d3_event) {
|
||||
var mode = context.mode() && context.mode().id;
|
||||
if (mode !== 'browse') return;
|
||||
|
||||
@@ -79,14 +78,14 @@ export function uiFeatureList(context) {
|
||||
}
|
||||
|
||||
|
||||
function keydown() {
|
||||
function keydown(d3_event) {
|
||||
if (d3_event.keyCode === 27) { // escape
|
||||
search.node().blur();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function keypress() {
|
||||
function keypress(d3_event) {
|
||||
var q = search.property('value'),
|
||||
items = list.selectAll('.feature-list-item');
|
||||
if (d3_event.keyCode === 13 && // ↩ Return
|
||||
@@ -338,7 +337,7 @@ export function uiFeatureList(context) {
|
||||
}
|
||||
|
||||
|
||||
function click(d) {
|
||||
function click(d3_event, d) {
|
||||
d3_event.preventDefault();
|
||||
|
||||
if (d.location) {
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
import * as countryCoder from '@ideditor/country-coder';
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { t, localizer } from '../core/localizer';
|
||||
import { svgIcon } from '../svg/icon';
|
||||
@@ -86,7 +86,7 @@ export function uiField(context, presetField, entityIDs, options) {
|
||||
}
|
||||
|
||||
|
||||
function revert(d) {
|
||||
function revert(d3_event, d) {
|
||||
d3_event.stopPropagation();
|
||||
d3_event.preventDefault();
|
||||
if (!entityIDs || _locked) return;
|
||||
@@ -95,7 +95,7 @@ export function uiField(context, presetField, entityIDs, options) {
|
||||
}
|
||||
|
||||
|
||||
function remove(d) {
|
||||
function remove(d3_event, d) {
|
||||
d3_event.stopPropagation();
|
||||
d3_event.preventDefault();
|
||||
if (_locked) return;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -151,7 +150,7 @@ export function uiFieldHelp(context, fieldName) {
|
||||
.attr('class', 'field-help-button')
|
||||
.call(svgIcon('#iD-icon-help'))
|
||||
.merge(button)
|
||||
.on('click', function () {
|
||||
.on('click', function (d3_event) {
|
||||
d3_event.stopPropagation();
|
||||
d3_event.preventDefault();
|
||||
if (_body.classed('hide')) {
|
||||
@@ -202,7 +201,7 @@ export function uiFieldHelp(context, fieldName) {
|
||||
titleEnter
|
||||
.append('button')
|
||||
.attr('class', 'fr close')
|
||||
.on('click', function() {
|
||||
.on('click', function(d3_event) {
|
||||
d3_event.stopPropagation();
|
||||
d3_event.preventDefault();
|
||||
hide();
|
||||
@@ -220,7 +219,7 @@ export function uiFieldHelp(context, fieldName) {
|
||||
.append('div')
|
||||
.attr('class', 'field-help-nav-item')
|
||||
.html(function(d) { return d; })
|
||||
.on('click', function(d, i) {
|
||||
.on('click', function(d3_event, d, i) {
|
||||
d3_event.stopPropagation();
|
||||
d3_event.preventDefault();
|
||||
clickHelp(i);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
|
||||
import {
|
||||
select as d3_select,
|
||||
event as d3_event
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { utilRebind } from '../../util/rebind';
|
||||
@@ -125,7 +124,7 @@ export function uiFieldCheck(field, context) {
|
||||
text = label.selectAll('span.value');
|
||||
|
||||
input
|
||||
.on('click', function() {
|
||||
.on('click', function(d3_event) {
|
||||
d3_event.stopPropagation();
|
||||
var t = {};
|
||||
|
||||
@@ -153,7 +152,7 @@ export function uiFieldCheck(field, context) {
|
||||
|
||||
reverser
|
||||
.call(reverserSetText)
|
||||
.on('click', function() {
|
||||
.on('click', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
context.perform(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
import { drag as d3_drag } from 'd3-drag';
|
||||
import * as countryCoder from '@ideditor/country-coder';
|
||||
|
||||
@@ -316,7 +316,7 @@ export function uiFieldCombo(field, context) {
|
||||
}
|
||||
|
||||
|
||||
function removeMultikey(d) {
|
||||
function removeMultikey(d3_event, d) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
var t = {};
|
||||
@@ -399,7 +399,7 @@ export function uiFieldCombo(field, context) {
|
||||
.on('blur', change);
|
||||
|
||||
_input
|
||||
.on('keydown.field', function() {
|
||||
.on('keydown.field', function(d3_event) {
|
||||
switch (d3_event.keyCode) {
|
||||
case 13: // ↩ Return
|
||||
_input.node().blur(); // blurring also enters the value
|
||||
@@ -568,14 +568,14 @@ export function uiFieldCombo(field, context) {
|
||||
// allow drag and drop re-ordering of chips
|
||||
var dragOrigin, targetIndex;
|
||||
selection.call(d3_drag()
|
||||
.on('start', function() {
|
||||
.on('start', function(d3_event) {
|
||||
dragOrigin = {
|
||||
x: d3_event.x,
|
||||
y: d3_event.y
|
||||
};
|
||||
targetIndex = null;
|
||||
})
|
||||
.on('drag', function(d, index) {
|
||||
.on('drag', function(d3_event, d, index) {
|
||||
var x = d3_event.x - dragOrigin.x,
|
||||
y = d3_event.y - dragOrigin.y;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { select as d3_select, event as d3_event } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
import * as countryCoder from '@ideditor/country-coder';
|
||||
|
||||
import { presetManager } from '../../presets';
|
||||
@@ -85,7 +85,7 @@ export function uiFieldText(field, context) {
|
||||
return 'form-field-button ' + which;
|
||||
})
|
||||
.merge(buttons)
|
||||
.on('click', function(d) {
|
||||
.on('click', function(d3_event, d) {
|
||||
d3_event.preventDefault();
|
||||
var raw_vals = input.node().value || '0';
|
||||
var vals = raw_vals.split(';');
|
||||
@@ -115,7 +115,7 @@ export function uiFieldText(field, context) {
|
||||
}
|
||||
return '';
|
||||
})
|
||||
.on('click', function() {
|
||||
.on('click', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
|
||||
var value = validIdentifierValueForLink();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { select as d3_select, event as d3_event } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
import * as countryCoder from '@ideditor/country-coder';
|
||||
|
||||
import { presetManager } from '../../presets';
|
||||
@@ -341,7 +341,7 @@ export function uiFieldLocalized(field, context) {
|
||||
}
|
||||
|
||||
|
||||
function addNew() {
|
||||
function addNew(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
if (field.locked()) return;
|
||||
|
||||
@@ -364,7 +364,7 @@ export function uiFieldLocalized(field, context) {
|
||||
|
||||
|
||||
function change(onInput) {
|
||||
return function() {
|
||||
return function(d3_event) {
|
||||
if (field.locked()) {
|
||||
d3_event.preventDefault();
|
||||
return;
|
||||
@@ -508,7 +508,7 @@ export function uiFieldLocalized(field, context) {
|
||||
label
|
||||
.append('button')
|
||||
.attr('class', 'remove-icon-multilingual')
|
||||
.on('click', function(d, index) {
|
||||
.on('click', function(d3_event, d, index) {
|
||||
if (field.locked()) return;
|
||||
d3_event.preventDefault();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { select as d3_select, event as d3_event } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { presetManager } from '../../presets';
|
||||
import { prefs } from '../../core/preferences';
|
||||
@@ -305,7 +305,7 @@ export function uiFieldRestrictions(field, context) {
|
||||
updateHints(null);
|
||||
|
||||
|
||||
function click() {
|
||||
function click(d3_event) {
|
||||
surface
|
||||
.call(breathe.off)
|
||||
.call(breathe);
|
||||
@@ -397,7 +397,7 @@ export function uiFieldRestrictions(field, context) {
|
||||
}
|
||||
|
||||
|
||||
function mouseover() {
|
||||
function mouseover(d3_event) {
|
||||
var datum = d3_event.target.__data__;
|
||||
updateHints(datum);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
|
||||
import {
|
||||
select as d3_select,
|
||||
event as d3_event
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { uiCombobox } from '../combobox';
|
||||
@@ -97,7 +96,7 @@ export function uiFieldWikidata(field, context) {
|
||||
.attr('class', 'form-field-button wiki-link')
|
||||
.attr('title', t('icons.view_on', { domain: 'wikidata.org' }))
|
||||
.call(svgIcon('#iD-icon-out-link'))
|
||||
.on('click', function() {
|
||||
.on('click', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
if (_wikiURL) window.open(_wikiURL, '_blank');
|
||||
});
|
||||
@@ -133,7 +132,7 @@ export function uiFieldWikidata(field, context) {
|
||||
.attr('class', 'form-field-button')
|
||||
.attr('title', t('icons.copy'))
|
||||
.call(svgIcon('#iD-operation-copy'))
|
||||
.on('click', function() {
|
||||
.on('click', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
d3_select(this.parentNode)
|
||||
.select('input')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { select as d3_select, event as d3_event } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { fileFetcher } from '../../core/file_fetcher';
|
||||
import { t, localizer } from '../../core/localizer';
|
||||
@@ -133,7 +133,7 @@ export function uiFieldWikipedia(field, context) {
|
||||
.merge(link);
|
||||
|
||||
link
|
||||
.on('click', () => {
|
||||
.on('click', (d3_event) => {
|
||||
d3_event.preventDefault();
|
||||
if (_wikiURL) window.open(_wikiURL, '_blank');
|
||||
});
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
|
||||
import { uiCmd } from './cmd';
|
||||
import { utilDetect } from '../util/detect';
|
||||
|
||||
|
||||
export function uiFullScreen(context) {
|
||||
var element = context.container().node();
|
||||
// var button = d3_select(null);
|
||||
@@ -48,7 +45,7 @@ export function uiFullScreen(context) {
|
||||
}
|
||||
|
||||
|
||||
function fullScreen() {
|
||||
function fullScreen(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
if (!isFullScreen()) {
|
||||
// button.classed('active', true);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -72,7 +71,7 @@ export function uiImproveOsmDetails(context) {
|
||||
.on('mouseleave', () => {
|
||||
utilHighlightEntities([entityID], false, context);
|
||||
})
|
||||
.on('click', () => {
|
||||
.on('click', (d3_event) => {
|
||||
d3_event.preventDefault();
|
||||
|
||||
utilHighlightEntities([entityID], false, context);
|
||||
|
||||
@@ -151,7 +151,7 @@ export function uiImproveOsmEditor(context) {
|
||||
|
||||
buttonSection.select('.comment-button')
|
||||
.attr('disabled', d => d.newComment ? null : true)
|
||||
.on('click.comment', function(d) {
|
||||
.on('click.comment', function(d3_event, d) {
|
||||
this.blur(); // avoid keeping focus on the button - #4641
|
||||
const qaService = services.improveOSM;
|
||||
if (qaService) {
|
||||
@@ -164,7 +164,7 @@ export function uiImproveOsmEditor(context) {
|
||||
const andComment = (d.newComment ? '_comment' : '');
|
||||
return t.html(`QA.keepRight.close${andComment}`);
|
||||
})
|
||||
.on('click.close', function(d) {
|
||||
.on('click.close', function(d3_event, d) {
|
||||
this.blur(); // avoid keeping focus on the button - #4641
|
||||
const qaService = services.improveOSM;
|
||||
if (qaService) {
|
||||
@@ -178,7 +178,7 @@ export function uiImproveOsmEditor(context) {
|
||||
const andComment = (d.newComment ? '_comment' : '');
|
||||
return t.html(`QA.keepRight.ignore${andComment}`);
|
||||
})
|
||||
.on('click.ignore', function(d) {
|
||||
.on('click.ignore', function(d3_event, d) {
|
||||
this.blur(); // avoid keeping focus on the button - #4641
|
||||
const qaService = services.improveOSM;
|
||||
if (qaService) {
|
||||
|
||||
+15
-9
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -64,7 +63,11 @@ export function uiInfo(context) {
|
||||
title
|
||||
.append('button')
|
||||
.attr('class', 'close')
|
||||
.on('click', function (d) { info.toggle(d); })
|
||||
.on('click', function(d3_event, d) {
|
||||
d3_event.stopImmediatePropagation();
|
||||
d3_event.preventDefault();
|
||||
info.toggle(d);
|
||||
})
|
||||
.call(svgIcon('#iD-icon-close'));
|
||||
|
||||
enter
|
||||
@@ -81,11 +84,6 @@ export function uiInfo(context) {
|
||||
|
||||
|
||||
info.toggle = function(which) {
|
||||
if (d3_event) {
|
||||
d3_event.stopImmediatePropagation();
|
||||
d3_event.preventDefault();
|
||||
}
|
||||
|
||||
var activeids = ids.filter(function(k) { return active[k]; });
|
||||
|
||||
if (which) { // toggle one
|
||||
@@ -123,13 +121,21 @@ export function uiInfo(context) {
|
||||
redraw();
|
||||
|
||||
context.keybinding()
|
||||
.on(uiCmd('⌘' + t('info_panels.key')), info.toggle);
|
||||
.on(uiCmd('⌘' + t('info_panels.key')), function(d3_event) {
|
||||
d3_event.stopImmediatePropagation();
|
||||
d3_event.preventDefault();
|
||||
info.toggle();
|
||||
});
|
||||
|
||||
ids.forEach(function(k) {
|
||||
var key = t('info_panels.' + k + '.key', { default: null });
|
||||
if (!key) return;
|
||||
context.keybinding()
|
||||
.on(uiCmd('⌘⇧' + key), function() { info.toggle(k); });
|
||||
.on(uiCmd('⌘⇧' + key), function(d3_event) {
|
||||
d3_event.stopImmediatePropagation();
|
||||
d3_event.preventDefault();
|
||||
info.toggle(k);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+9
-10
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -58,7 +57,7 @@ export function uiInit(context) {
|
||||
function render(container) {
|
||||
|
||||
container
|
||||
.on('click.ui', function() {
|
||||
.on('click.ui', function(d3_event) {
|
||||
// we're only concerned with the primary mouse button
|
||||
if (d3_event.button !== 0) return;
|
||||
|
||||
@@ -92,7 +91,7 @@ export function uiInit(context) {
|
||||
// On iOS we disable pinch-to-zoom of the UI via the `touch-action`
|
||||
// CSS property, but on desktop Safari we need to manually cancel the
|
||||
// default gesture events.
|
||||
container.on('gesturestart.ui gesturechange.ui gestureend.ui', function() {
|
||||
container.on('gesturestart.ui gesturechange.ui gestureend.ui', function(d3_event) {
|
||||
// disable pinch-to-zoom of the UI via multitouch trackpads on macOS Safari
|
||||
d3_event.preventDefault();
|
||||
});
|
||||
@@ -100,7 +99,7 @@ export function uiInit(context) {
|
||||
|
||||
if ('PointerEvent' in window) {
|
||||
d3_select(window)
|
||||
.on('pointerdown.ui pointerup.ui', function() {
|
||||
.on('pointerdown.ui pointerup.ui', function(d3_event) {
|
||||
var pointerType = d3_event.pointerType || 'mouse';
|
||||
if (_lastPointerType !== pointerType) {
|
||||
_lastPointerType = pointerType;
|
||||
@@ -349,7 +348,7 @@ export function uiInit(context) {
|
||||
|
||||
var panPixels = 80;
|
||||
context.keybinding()
|
||||
.on('⌫', function() { d3_event.preventDefault(); })
|
||||
.on('⌫', function(d3_event) { d3_event.preventDefault(); })
|
||||
.on([t('sidebar.key'), '`', '²', '@'], ui.sidebar.toggle) // #5663, #6864 - common QWERTY, AZERTY
|
||||
.on('←', pan([panPixels, 0]))
|
||||
.on('↑', pan([0, panPixels]))
|
||||
@@ -359,7 +358,7 @@ export function uiInit(context) {
|
||||
.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() {
|
||||
.on(uiCmd('⌘' + t('background.key')), function quickSwitch(d3_event) {
|
||||
if (d3_event) {
|
||||
d3_event.stopImmediatePropagation();
|
||||
d3_event.preventDefault();
|
||||
@@ -372,12 +371,12 @@ export function uiInit(context) {
|
||||
context.background().baseLayerSource(previousBackground);
|
||||
}
|
||||
})
|
||||
.on(t('area_fill.wireframe.key'), function toggleWireframe() {
|
||||
.on(t('area_fill.wireframe.key'), function toggleWireframe(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
context.map().toggleWireframe();
|
||||
})
|
||||
.on(uiCmd('⌥' + t('area_fill.wireframe.key')), function toggleOsmData() {
|
||||
.on(uiCmd('⌥' + t('area_fill.wireframe.key')), function toggleOsmData(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
|
||||
@@ -393,7 +392,7 @@ export function uiInit(context) {
|
||||
}
|
||||
}
|
||||
})
|
||||
.on(t('map_data.highlight_edits.key'), function toggleHighlightEdited() {
|
||||
.on(t('map_data.highlight_edits.key'), function toggleHighlightEdited(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
context.map().toggleHighlightEdited();
|
||||
});
|
||||
@@ -444,7 +443,7 @@ export function uiInit(context) {
|
||||
|
||||
|
||||
function pan(d) {
|
||||
return function() {
|
||||
return function(d3_event) {
|
||||
if (d3_event.shiftKey) return;
|
||||
if (context.container().select('.combobox').size()) return;
|
||||
d3_event.preventDefault();
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
|
||||
import {
|
||||
event as d3_event
|
||||
} from 'd3-selection';
|
||||
|
||||
import {
|
||||
interpolateNumber as d3_interpolateNumber
|
||||
} from 'd3-interpolate';
|
||||
@@ -36,7 +32,7 @@ export function uiIntroArea(context, reveal) {
|
||||
}
|
||||
|
||||
|
||||
function eventCancel() {
|
||||
function eventCancel(d3_event) {
|
||||
d3_event.stopPropagation();
|
||||
d3_event.preventDefault();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
|
||||
import {
|
||||
event as d3_event
|
||||
} from 'd3-selection';
|
||||
|
||||
import { presetManager } from '../../presets';
|
||||
import { t } from '../../core/localizer';
|
||||
import { modeBrowse } from '../../modes/browse';
|
||||
@@ -34,7 +30,7 @@ export function uiIntroBuilding(context, reveal) {
|
||||
}
|
||||
|
||||
|
||||
function eventCancel() {
|
||||
function eventCancel(d3_event) {
|
||||
d3_event.stopPropagation();
|
||||
d3_event.preventDefault();
|
||||
}
|
||||
|
||||
@@ -198,10 +198,10 @@ export function uiIntro(context) {
|
||||
.attr('class', 'status')
|
||||
.call(svgIcon((localizer.textDirection() === 'rtl' ? '#iD-icon-backward' : '#iD-icon-forward'), 'inline'));
|
||||
|
||||
enterChapter(chapters[0]);
|
||||
enterChapter(null, chapters[0]);
|
||||
|
||||
|
||||
function enterChapter(newChapter) {
|
||||
function enterChapter(d3_event, newChapter) {
|
||||
if (_currChapter) { _currChapter.exit(); }
|
||||
context.enter(modeBrowse(context));
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -50,7 +49,7 @@ export function uiIntroLine(context, reveal) {
|
||||
}
|
||||
|
||||
|
||||
function eventCancel() {
|
||||
function eventCancel(d3_event) {
|
||||
d3_event.stopPropagation();
|
||||
d3_event.preventDefault();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -35,7 +34,7 @@ export function uiIntroNavigation(context, reveal) {
|
||||
}
|
||||
|
||||
|
||||
function eventCancel() {
|
||||
function eventCancel(d3_event) {
|
||||
d3_event.stopPropagation();
|
||||
d3_event.preventDefault();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -32,7 +31,7 @@ export function uiIntroPoint(context, reveal) {
|
||||
}
|
||||
|
||||
|
||||
function eventCancel() {
|
||||
function eventCancel(d3_event) {
|
||||
d3_event.stopPropagation();
|
||||
d3_event.preventDefault();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { prefs } from '../core/preferences';
|
||||
import { svgIcon } from '../svg/icon';
|
||||
@@ -66,7 +66,7 @@ export function uiIssuesInfo(context) {
|
||||
|
||||
chipSelection
|
||||
.call(tooltipBehavior)
|
||||
.on('click', function() {
|
||||
.on('click', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
|
||||
tooltipBehavior.hide(d3_select(this));
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -77,7 +76,7 @@ export function uiKeepRightDetails(context) {
|
||||
.on('mouseleave', () => {
|
||||
utilHighlightEntities([entityID], false, context);
|
||||
})
|
||||
.on('click', () => {
|
||||
.on('click', (d3_event) => {
|
||||
d3_event.preventDefault();
|
||||
|
||||
utilHighlightEntities([entityID], false, context);
|
||||
|
||||
@@ -162,7 +162,7 @@ export function uiKeepRightEditor(context) {
|
||||
|
||||
buttonSection.select('.comment-button') // select and propagate data
|
||||
.attr('disabled', d => d.newComment ? null : true)
|
||||
.on('click.comment', function(d) {
|
||||
.on('click.comment', function(d3_event, d) {
|
||||
this.blur(); // avoid keeping focus on the button - #4641
|
||||
const qaService = services.keepRight;
|
||||
if (qaService) {
|
||||
@@ -175,7 +175,7 @@ export function uiKeepRightEditor(context) {
|
||||
const andComment = (d.newComment ? '_comment' : '');
|
||||
return t.html(`QA.keepRight.close${andComment}`);
|
||||
})
|
||||
.on('click.close', function(d) {
|
||||
.on('click.close', function(d3_event, d) {
|
||||
this.blur(); // avoid keeping focus on the button - #4641
|
||||
const qaService = services.keepRight;
|
||||
if (qaService) {
|
||||
@@ -189,7 +189,7 @@ export function uiKeepRightEditor(context) {
|
||||
const andComment = (d.newComment ? '_comment' : '');
|
||||
return t.html(`QA.keepRight.ignore${andComment}`);
|
||||
})
|
||||
.on('click.ignore', function(d) {
|
||||
.on('click.ignore', function(d3_event, d) {
|
||||
this.blur(); // avoid keeping focus on the button - #4641
|
||||
const qaService = services.keepRight;
|
||||
if (qaService) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { geoPath as d3_geoPath } from 'd3-geo';
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
import { zoom as d3_zoom, zoomIdentity as d3_zoomIdentity } from 'd3-zoom';
|
||||
|
||||
import { t } from '../core/localizer';
|
||||
@@ -47,7 +47,7 @@ export function uiMapInMap(context) {
|
||||
}
|
||||
|
||||
|
||||
function zoomed() {
|
||||
function zoomed(d3_event) {
|
||||
if (_skipEvents) return;
|
||||
|
||||
var x = d3_event.transform.x;
|
||||
@@ -258,7 +258,7 @@ export function uiMapInMap(context) {
|
||||
}
|
||||
|
||||
|
||||
function toggle() {
|
||||
function toggle(d3_event) {
|
||||
if (d3_event) d3_event.preventDefault();
|
||||
|
||||
_isHidden = !_isHidden;
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { svgIcon } from '../svg/icon';
|
||||
import { utilKeybinding } from '../util';
|
||||
@@ -46,7 +46,7 @@ export function uiModal(selection, blocking) {
|
||||
.on('focus.keytrap', moveFocusToLast);
|
||||
|
||||
if (!blocking) {
|
||||
shaded.on('click.remove-modal', () => {
|
||||
shaded.on('click.remove-modal', (d3_event) => {
|
||||
if (d3_event.target === this) {
|
||||
shaded.close();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -176,7 +175,7 @@ export function uiNoteEditor(context) {
|
||||
|
||||
|
||||
// fast submit if user presses cmd+enter
|
||||
function keydown() {
|
||||
function keydown(d3_event) {
|
||||
if (!(d3_event.keyCode === 13 && // ↩ Return
|
||||
d3_event.metaKey)) return;
|
||||
|
||||
@@ -265,7 +264,7 @@ export function uiNoteEditor(context) {
|
||||
.call(svgIcon('#iD-icon-out-link', 'inline'))
|
||||
.append('span')
|
||||
.html(t.html('login'))
|
||||
.on('click.note-login', function() {
|
||||
.on('click.note-login', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
osm.authenticate();
|
||||
});
|
||||
@@ -385,7 +384,7 @@ export function uiNoteEditor(context) {
|
||||
|
||||
|
||||
|
||||
function clickCancel(d) {
|
||||
function clickCancel(d3_event, d) {
|
||||
this.blur(); // avoid keeping focus on the button - #4641
|
||||
var osm = services.osm;
|
||||
if (osm) {
|
||||
@@ -396,7 +395,7 @@ export function uiNoteEditor(context) {
|
||||
}
|
||||
|
||||
|
||||
function clickSave(d) {
|
||||
function clickSave(d3_event, d) {
|
||||
this.blur(); // avoid keeping focus on the button - #4641
|
||||
var osm = services.osm;
|
||||
if (osm) {
|
||||
@@ -407,7 +406,7 @@ export function uiNoteEditor(context) {
|
||||
}
|
||||
|
||||
|
||||
function clickStatus(d) {
|
||||
function clickStatus(d3_event, d) {
|
||||
this.blur(); // avoid keeping focus on the button - #4641
|
||||
var osm = services.osm;
|
||||
if (osm) {
|
||||
@@ -418,7 +417,7 @@ export function uiNoteEditor(context) {
|
||||
}
|
||||
}
|
||||
|
||||
function clickComment(d) {
|
||||
function clickComment(d3_event, d) {
|
||||
this.blur(); // avoid keeping focus on the button - #4641
|
||||
var osm = services.osm;
|
||||
if (osm) {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import _debounce from 'lodash-es/debounce';
|
||||
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
|
||||
import { t } from '../core/localizer';
|
||||
import { svgIcon } from '../svg/index';
|
||||
|
||||
@@ -19,7 +17,7 @@ export function uiNotice(context) {
|
||||
.on('click', function() {
|
||||
context.map().zoomEase(context.minEditableZoom());
|
||||
})
|
||||
.on('wheel', function() { // let wheel events pass through #4482
|
||||
.on('wheel', function(d3_event) { // let wheel events pass through #4482
|
||||
var e2 = new WheelEvent(d3_event.type, d3_event);
|
||||
context.surface().node().dispatchEvent(e2);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -155,7 +154,7 @@ export function uiOsmoseDetails(context) {
|
||||
.on('mouseleave', () => {
|
||||
utilHighlightEntities([entityID], false, context);
|
||||
})
|
||||
.on('click', () => {
|
||||
.on('click', (d3_event) => {
|
||||
d3_event.preventDefault();
|
||||
|
||||
utilHighlightEntities([entityID], false, context);
|
||||
|
||||
@@ -118,7 +118,7 @@ export function uiOsmoseEditor(context) {
|
||||
|
||||
buttonSection.select('.close-button')
|
||||
.html(t.html('QA.keepRight.close'))
|
||||
.on('click.close', function(d) {
|
||||
.on('click.close', function(d3_event, d) {
|
||||
this.blur(); // avoid keeping focus on the button - #4641
|
||||
const qaService = services.osmose;
|
||||
if (qaService) {
|
||||
@@ -129,7 +129,7 @@ export function uiOsmoseEditor(context) {
|
||||
|
||||
buttonSection.select('.ignore-button')
|
||||
.html(t.html('QA.keepRight.ignore'))
|
||||
.on('click.ignore', function(d) {
|
||||
.on('click.ignore', function(d3_event, d) {
|
||||
this.blur(); // avoid keeping focus on the button - #4641
|
||||
const qaService = services.osmose;
|
||||
if (qaService) {
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -62,7 +61,7 @@ export function uiPane(id, context) {
|
||||
context.ui().togglePanes();
|
||||
}
|
||||
|
||||
pane.togglePane = function() {
|
||||
pane.togglePane = function(d3_event) {
|
||||
if (d3_event) d3_event.preventDefault();
|
||||
_paneTooltip.hide();
|
||||
context.ui().togglePanes(!_paneSelection.classed('shown') ? _paneSelection : undefined);
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import _debounce from 'lodash-es/debounce';
|
||||
|
||||
import {
|
||||
event as d3_event
|
||||
} from 'd3-selection';
|
||||
|
||||
import { t } from '../../core/localizer';
|
||||
|
||||
|
||||
@@ -62,7 +58,7 @@ export function uiPanelBackground(context) {
|
||||
.html(t.html('info_panels.background.' + toggleTiles))
|
||||
.attr('href', '#')
|
||||
.attr('class', 'button button-toggle-tiles')
|
||||
.on('click', function() {
|
||||
.on('click', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
context.setDebug('tile', !context.getDebug('tile'));
|
||||
selection.call(redraw);
|
||||
@@ -78,7 +74,7 @@ export function uiPanelBackground(context) {
|
||||
.html(t.html('info_panels.background.' + toggleVintage))
|
||||
.attr('href', '#')
|
||||
.attr('class', 'button button-toggle-vintage')
|
||||
.on('click', function() {
|
||||
.on('click', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
context.background().toggleOverlayLayer(sourceVintage);
|
||||
selection.call(redraw);
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
|
||||
import {
|
||||
geoLength as d3_geoLength,
|
||||
geoCentroid as d3_geoCentroid
|
||||
@@ -202,7 +200,7 @@ export function uiPanelMeasurement(context) {
|
||||
.html(t.html('info_panels.measurement.' + toggle))
|
||||
.attr('href', '#')
|
||||
.attr('class', 'button button-toggle-units')
|
||||
.on('click', function() {
|
||||
.on('click', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
isImperial = !isImperial;
|
||||
selection.call(redraw);
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
|
||||
import marked from 'marked';
|
||||
import { svgIcon } from '../../svg/icon';
|
||||
import { uiIntro } from '../intro/intro';
|
||||
@@ -282,7 +279,7 @@ export function uiPaneHelp(context) {
|
||||
|
||||
helpPane.renderContent = function(content) {
|
||||
|
||||
function clickHelp(d, i) {
|
||||
function clickHelp(d3_event, d, i) {
|
||||
if (d3_event) d3_event.preventDefault();
|
||||
var rtl = (localizer.textDirection() === 'rtl');
|
||||
content.property('scrollTop', 0);
|
||||
@@ -309,9 +306,9 @@ export function uiPaneHelp(context) {
|
||||
.append('a')
|
||||
.attr('href', '#')
|
||||
.attr('class', 'next')
|
||||
.on('click', function() {
|
||||
.on('click', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
clickHelp(docs[i + 1], i + 1);
|
||||
clickHelp(null, docs[i + 1], i + 1);
|
||||
});
|
||||
|
||||
nextLink
|
||||
@@ -328,9 +325,9 @@ export function uiPaneHelp(context) {
|
||||
.append('a')
|
||||
.attr('href', '#')
|
||||
.attr('class', 'previous')
|
||||
.on('click', function() {
|
||||
.on('click', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
clickHelp(docs[i - 1], i - 1);
|
||||
clickHelp(null, docs[i - 1], i - 1);
|
||||
});
|
||||
|
||||
prevLink
|
||||
@@ -342,7 +339,7 @@ export function uiPaneHelp(context) {
|
||||
}
|
||||
|
||||
|
||||
function clickWalkthrough() {
|
||||
function clickWalkthrough(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
if (context.inIntro()) return;
|
||||
context.container().call(uiIntro(context));
|
||||
@@ -350,7 +347,7 @@ export function uiPaneHelp(context) {
|
||||
}
|
||||
|
||||
|
||||
function clickShortcuts() {
|
||||
function clickShortcuts(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
context.container().call(context.ui().shortcuts, true);
|
||||
}
|
||||
@@ -414,7 +411,7 @@ export function uiPaneHelp(context) {
|
||||
.append('div')
|
||||
.attr('class', 'nav');
|
||||
|
||||
clickHelp(docs[0], 0);
|
||||
clickHelp(null, docs[0], 0);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -27,7 +26,7 @@ export function uiPhotoviewer(context) {
|
||||
.append('div')
|
||||
.call(svgIcon('#iD-icon-close'));
|
||||
|
||||
function preventDefault() {
|
||||
function preventDefault(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
}
|
||||
|
||||
@@ -70,7 +69,7 @@ export function uiPhotoviewer(context) {
|
||||
var startWidth;
|
||||
var startHeight;
|
||||
|
||||
function startResize() {
|
||||
function startResize(d3_event) {
|
||||
if (pointerId !== (d3_event.pointerId || 'mouse')) return;
|
||||
|
||||
d3_event.preventDefault();
|
||||
@@ -97,7 +96,7 @@ export function uiPhotoviewer(context) {
|
||||
return Math.max(min, Math.min(num, max));
|
||||
}
|
||||
|
||||
function stopResize() {
|
||||
function stopResize(d3_event) {
|
||||
if (pointerId !== (d3_event.pointerId || 'mouse')) return;
|
||||
|
||||
d3_event.preventDefault();
|
||||
@@ -108,7 +107,7 @@ export function uiPhotoviewer(context) {
|
||||
.on('.' + eventName, null);
|
||||
}
|
||||
|
||||
return function initResize() {
|
||||
return function initResize(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
import { utilFunctor } from '../util/util';
|
||||
|
||||
var _popoverID = 0;
|
||||
@@ -150,7 +150,7 @@ export function uiPopover(klass) {
|
||||
|
||||
if (display === 'hover') {
|
||||
var _lastNonMouseEnterTime;
|
||||
anchor.on(_pointerPrefix + 'enter.popover', function() {
|
||||
anchor.on(_pointerPrefix + 'enter.popover', function(d3_event) {
|
||||
|
||||
if (d3_event.pointerType) {
|
||||
if (d3_event.pointerType !== 'mouse') {
|
||||
@@ -185,11 +185,11 @@ export function uiPopover(klass) {
|
||||
|
||||
} else if (display === 'clickFocus') {
|
||||
anchor
|
||||
.on(_pointerPrefix + 'down.popover', function() {
|
||||
.on(_pointerPrefix + 'down.popover', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
})
|
||||
.on(_pointerPrefix + 'up.popover', function() {
|
||||
.on(_pointerPrefix + 'up.popover', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
})
|
||||
|
||||
+10
-11
@@ -2,7 +2,6 @@ import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import * as countryCoder from '@ideditor/country-coder';
|
||||
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -46,7 +45,7 @@ export function uiPresetList(context) {
|
||||
.on('click', function() { dispatch.call('cancel', this); })
|
||||
.call(svgIcon((localizer.textDirection() === 'rtl') ? '#iD-icon-backward' : '#iD-icon-forward'));
|
||||
|
||||
function initialKeydown() {
|
||||
function initialKeydown(d3_event) {
|
||||
// hack to let delete shortcut work when search is autofocused
|
||||
if (search.property('value').length === 0 &&
|
||||
(d3_event.keyCode === utilKeybinding.keyCodes['⌫'] ||
|
||||
@@ -65,11 +64,11 @@ export function uiPresetList(context) {
|
||||
} else if (!d3_event.ctrlKey && !d3_event.metaKey) {
|
||||
// don't check for delete/undo hack on future keydown events
|
||||
d3_select(this).on('keydown', keydown);
|
||||
keydown.call(this);
|
||||
keydown.call(this, d3_event);
|
||||
}
|
||||
}
|
||||
|
||||
function keydown() {
|
||||
function keydown(d3_event) {
|
||||
// down arrow
|
||||
if (d3_event.keyCode === utilKeybinding.keyCodes['↓'] &&
|
||||
// if insertion point is at the end of the string
|
||||
@@ -82,7 +81,7 @@ export function uiPresetList(context) {
|
||||
}
|
||||
}
|
||||
|
||||
function keypress() {
|
||||
function keypress(d3_event) {
|
||||
// enter
|
||||
var value = search.property('value');
|
||||
if (d3_event.keyCode === 13 && // ↩ Return
|
||||
@@ -191,7 +190,7 @@ export function uiPresetList(context) {
|
||||
updateForFeatureHiddenState();
|
||||
}
|
||||
|
||||
function itemKeydown(){
|
||||
function itemKeydown(d3_event) {
|
||||
// the actively focused item
|
||||
var item = d3_select(this.closest('.preset-list-item'));
|
||||
var parentItem = d3_select(item.node().parentNode.closest('.preset-list-item'));
|
||||
@@ -295,7 +294,7 @@ export function uiPresetList(context) {
|
||||
.geometry(geometries.length === 1 && geometries[0])
|
||||
.preset(preset))
|
||||
.on('click', click)
|
||||
.on('keydown', function() {
|
||||
.on('keydown', function(d3_event) {
|
||||
// right arrow, expand the focused item
|
||||
if (d3_event.keyCode === utilKeybinding.keyCodes[(localizer.textDirection() === 'rtl') ? '←' : '→']) {
|
||||
d3_event.preventDefault();
|
||||
@@ -303,7 +302,7 @@ export function uiPresetList(context) {
|
||||
// if the item isn't expanded
|
||||
if (!d3_select(this).classed('expanded')) {
|
||||
// toggle expansion (expand the item)
|
||||
click.call(this);
|
||||
click.call(this, d3_event);
|
||||
}
|
||||
// left arrow, collapse the focused item
|
||||
} else if (d3_event.keyCode === utilKeybinding.keyCodes[(localizer.textDirection() === 'rtl') ? '→' : '←']) {
|
||||
@@ -312,10 +311,10 @@ export function uiPresetList(context) {
|
||||
// if the item is expanded
|
||||
if (d3_select(this).classed('expanded')) {
|
||||
// toggle expansion (collapse the item)
|
||||
click.call(this);
|
||||
click.call(this, d3_event);
|
||||
}
|
||||
} else {
|
||||
itemKeydown.call(this);
|
||||
itemKeydown.call(this, d3_event);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -430,7 +429,7 @@ export function uiPresetList(context) {
|
||||
dispatch.call('choose', this, preset);
|
||||
};
|
||||
|
||||
item.help = function() {
|
||||
item.help = function(d3_event) {
|
||||
d3_event.stopPropagation();
|
||||
item.reference.toggle();
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -36,7 +35,7 @@ export function uiSectionBackgroundDisplayOptions(context) {
|
||||
return Math.max(min, Math.min(x, max));
|
||||
}
|
||||
|
||||
function updateValue(d, val) {
|
||||
function updateValue(d3_event, d, val) {
|
||||
if (!val && d3_event && d3_event.target) {
|
||||
val = d3_event.target.value;
|
||||
}
|
||||
@@ -85,7 +84,7 @@ export function uiSectionBackgroundDisplayOptions(context) {
|
||||
.attr('min', _minVal)
|
||||
.attr('max', _maxVal)
|
||||
.attr('step', '0.05')
|
||||
.on('input', function(d) {
|
||||
.on('input', function(d3_event, d) {
|
||||
var val = d3_select(this).property('value');
|
||||
updateValue(d, val);
|
||||
});
|
||||
@@ -94,7 +93,7 @@ export function uiSectionBackgroundDisplayOptions(context) {
|
||||
.append('button')
|
||||
.attr('title', t('background.reset'))
|
||||
.attr('class', function(d) { return 'display-option-reset display-option-reset-' + d; })
|
||||
.on('click', function(d) {
|
||||
.on('click', function(d3_event, d) {
|
||||
if (d3_event.button !== 0) return;
|
||||
updateValue(d, 1);
|
||||
})
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import _debounce from 'lodash-es/debounce';
|
||||
import { descending as d3_descending, ascending as d3_ascending } from 'd3-array';
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -64,7 +63,7 @@ export function uiSectionBackgroundList(context) {
|
||||
minimapLabelEnter
|
||||
.append('input')
|
||||
.attr('type', 'checkbox')
|
||||
.on('change', function() {
|
||||
.on('change', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
uiMapInMap.toggle();
|
||||
});
|
||||
@@ -87,7 +86,7 @@ export function uiSectionBackgroundList(context) {
|
||||
panelLabelEnter
|
||||
.append('input')
|
||||
.attr('type', 'checkbox')
|
||||
.on('change', function() {
|
||||
.on('change', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
context.ui().info.toggle('background');
|
||||
});
|
||||
@@ -109,7 +108,7 @@ export function uiSectionBackgroundList(context) {
|
||||
locPanelLabelEnter
|
||||
.append('input')
|
||||
.attr('type', 'checkbox')
|
||||
.on('change', function() {
|
||||
.on('change', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
context.ui().info.toggle('location');
|
||||
});
|
||||
@@ -133,7 +132,11 @@ export function uiSectionBackgroundList(context) {
|
||||
.html(t.html('background.imagery_problem_faq'));
|
||||
|
||||
_backgroundList
|
||||
.call(drawListItems, 'radio', chooseBackground, function(d) { return !d.isHidden() && !d.overlay; });
|
||||
.call(drawListItems, 'radio', function(d3_event, d) {
|
||||
chooseBackground(d);
|
||||
}, function(d) {
|
||||
return !d.isHidden() && !d.overlay;
|
||||
});
|
||||
}
|
||||
|
||||
function setTooltips(selection) {
|
||||
@@ -262,7 +265,7 @@ export function uiSectionBackgroundList(context) {
|
||||
}
|
||||
|
||||
|
||||
function editCustom() {
|
||||
function editCustom(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
context.container()
|
||||
.call(_settingsCustomBackground);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -26,7 +25,7 @@ export function uiSectionBackgroundOffset(context) {
|
||||
];
|
||||
|
||||
|
||||
function cancelEvent() {
|
||||
function cancelEvent(d3_event) {
|
||||
d3_event.stopPropagation();
|
||||
d3_event.preventDefault();
|
||||
}
|
||||
@@ -104,7 +103,7 @@ export function uiSectionBackgroundOffset(context) {
|
||||
}
|
||||
|
||||
|
||||
function dragOffset() {
|
||||
function dragOffset(d3_event) {
|
||||
if (d3_event.button !== 0) return;
|
||||
|
||||
var origin = [d3_event.clientX, d3_event.clientY];
|
||||
@@ -124,7 +123,7 @@ export function uiSectionBackgroundOffset(context) {
|
||||
.on('pointercancel.drag-bg-offset', pointerup);
|
||||
}
|
||||
|
||||
function pointermove() {
|
||||
function pointermove(d3_event) {
|
||||
if (pointerId !== (d3_event.pointerId || 'mouse')) return;
|
||||
|
||||
var latest = [d3_event.clientX, d3_event.clientY];
|
||||
@@ -137,7 +136,7 @@ export function uiSectionBackgroundOffset(context) {
|
||||
nudge(d);
|
||||
}
|
||||
|
||||
function pointerup() {
|
||||
function pointerup(d3_event) {
|
||||
if (pointerId !== (d3_event.pointerId || 'mouse')) return;
|
||||
if (d3_event.button !== 0) return;
|
||||
|
||||
@@ -182,7 +181,7 @@ export function uiSectionBackgroundOffset(context) {
|
||||
.append('button')
|
||||
.attr('class', function(d) { return d[0] + ' nudge'; })
|
||||
.on('contextmenu', cancelEvent)
|
||||
.on(_pointerPrefix + 'down', function(d) {
|
||||
.on(_pointerPrefix + 'down', function(d3_event, d) {
|
||||
if (d3_event.button !== 0) return;
|
||||
pointerdownNudgeButton(d[1]);
|
||||
});
|
||||
@@ -192,7 +191,7 @@ export function uiSectionBackgroundOffset(context) {
|
||||
.attr('title', t('background.reset'))
|
||||
.attr('class', 'nudge-reset disabled')
|
||||
.on('contextmenu', cancelEvent)
|
||||
.on('click', function() {
|
||||
.on('click', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
if (d3_event.button !== 0) return;
|
||||
resetOffset();
|
||||
|
||||
@@ -150,7 +150,7 @@ export function uiSectionChanges(context) {
|
||||
}
|
||||
|
||||
|
||||
function click(change) {
|
||||
function click(d3_event, change) {
|
||||
if (change.changeType !== 'deleted') {
|
||||
var entity = change.entity;
|
||||
context.map().zoomToEase(entity);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import _debounce from 'lodash-es/debounce';
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -112,7 +111,7 @@ export function uiSectionDataLayers(context) {
|
||||
labelEnter
|
||||
.append('input')
|
||||
.attr('type', 'checkbox')
|
||||
.on('change', function(d) { toggleLayer(d.id); });
|
||||
.on('change', function(d3_event, d) { toggleLayer(d.id); });
|
||||
|
||||
labelEnter
|
||||
.append('span')
|
||||
@@ -163,7 +162,7 @@ export function uiSectionDataLayers(context) {
|
||||
labelEnter
|
||||
.append('input')
|
||||
.attr('type', 'checkbox')
|
||||
.on('change', function(d) { toggleLayer(d.id); });
|
||||
.on('change', function(d3_event, d) { toggleLayer(d.id); });
|
||||
|
||||
labelEnter
|
||||
.append('span')
|
||||
@@ -280,7 +279,7 @@ export function uiSectionDataLayers(context) {
|
||||
return dataLayer && dataLayer.template() === d.template;
|
||||
}
|
||||
|
||||
function selectVTLayer(d) {
|
||||
function selectVTLayer(d3_event, d) {
|
||||
prefs('settings-custom-data-url', d.template);
|
||||
if (dataLayer) {
|
||||
dataLayer.template(d.template, d.src);
|
||||
@@ -344,7 +343,7 @@ export function uiSectionDataLayers(context) {
|
||||
.title(t.html('map_data.layers.custom.zoom'))
|
||||
.placement((localizer.textDirection() === 'rtl') ? 'right' : 'left')
|
||||
)
|
||||
.on('click', function() {
|
||||
.on('click', function(d3_event) {
|
||||
if (d3_select(this).classed('disabled')) return;
|
||||
|
||||
d3_event.preventDefault();
|
||||
@@ -369,7 +368,7 @@ export function uiSectionDataLayers(context) {
|
||||
.classed('disabled', !hasData);
|
||||
}
|
||||
|
||||
function editCustom() {
|
||||
function editCustom(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
context.container()
|
||||
.call(settingsCustomData);
|
||||
@@ -407,7 +406,7 @@ export function uiSectionDataLayers(context) {
|
||||
historyPanelLabelEnter
|
||||
.append('input')
|
||||
.attr('type', 'checkbox')
|
||||
.on('change', function() {
|
||||
.on('change', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
context.ui().info.toggle('history');
|
||||
});
|
||||
@@ -429,7 +428,7 @@ export function uiSectionDataLayers(context) {
|
||||
measurementPanelLabelEnter
|
||||
.append('input')
|
||||
.attr('type', 'checkbox')
|
||||
.on('change', function() {
|
||||
.on('change', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
context.ui().info.toggle('measurement');
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { svgIcon } from '../../svg/icon';
|
||||
import { utilArrayIdentical } from '../../util/array';
|
||||
@@ -63,14 +63,14 @@ export function uiSectionEntityIssues(context) {
|
||||
var itemsEnter = containersEnter
|
||||
.append('div')
|
||||
.attr('class', function(d) { return 'issue severity-' + d.severity; })
|
||||
.on('mouseover.highlight', function(d) {
|
||||
.on('mouseover.highlight', function(d3_event, d) {
|
||||
// don't hover-highlight the selected entity
|
||||
var ids = d.entityIds
|
||||
.filter(function(e) { return _entityIDs.indexOf(e) === -1; });
|
||||
|
||||
utilHighlightEntities(ids, true, context);
|
||||
})
|
||||
.on('mouseout.highlight', function(d) {
|
||||
.on('mouseout.highlight', function(d3_event, d) {
|
||||
var ids = d.entityIds
|
||||
.filter(function(e) { return _entityIDs.indexOf(e) === -1; });
|
||||
|
||||
@@ -84,7 +84,7 @@ export function uiSectionEntityIssues(context) {
|
||||
var textEnter = labelsEnter
|
||||
.append('button')
|
||||
.attr('class', 'issue-text')
|
||||
.on('click', function(d) {
|
||||
.on('click', function(d3_event, d) {
|
||||
|
||||
makeActiveIssue(d.id); // expand only the clicked item
|
||||
|
||||
@@ -114,7 +114,7 @@ export function uiSectionEntityIssues(context) {
|
||||
.call(svgIcon('#iD-icon-inspect'));
|
||||
|
||||
infoButton
|
||||
.on('click', function () {
|
||||
.on('click', function (d3_event) {
|
||||
d3_event.stopPropagation();
|
||||
d3_event.preventDefault();
|
||||
this.blur(); // avoid keeping focus on the button - #4641
|
||||
@@ -190,7 +190,7 @@ export function uiSectionEntityIssues(context) {
|
||||
|
||||
var buttons = fixesEnter
|
||||
.append('button')
|
||||
.on('click', function(d) {
|
||||
.on('click', function(d3_event, d) {
|
||||
// not all fixes are actionable
|
||||
if (d3_select(this).attr('disabled') || !d.onClick) return;
|
||||
|
||||
@@ -214,10 +214,10 @@ export function uiSectionEntityIssues(context) {
|
||||
context.validator().validate();
|
||||
});
|
||||
})
|
||||
.on('mouseover.highlight', function(d) {
|
||||
.on('mouseover.highlight', function(d3_event, d) {
|
||||
utilHighlightEntities(d.entityIds, true, context);
|
||||
})
|
||||
.on('mouseout.highlight', function(d) {
|
||||
.on('mouseout.highlight', function(d3_event, d) {
|
||||
utilHighlightEntities(d.entityIds, false, context);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import {
|
||||
event as d3_event
|
||||
} from 'd3-selection';
|
||||
|
||||
import { presetManager } from '../../presets';
|
||||
import { utilArrayIdentical } from '../../util/array';
|
||||
@@ -83,7 +80,7 @@ export function uiSectionFeatureType(context) {
|
||||
.on('click', function() {
|
||||
dispatch.call('choose', this, _presets);
|
||||
})
|
||||
.on('pointerdown pointerup mousedown mouseup', function() {
|
||||
.on('pointerdown pointerup mousedown mouseup', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
});
|
||||
|
||||
@@ -109,7 +109,7 @@ export function uiSectionMapFeatures(context) {
|
||||
return context.features().enabled(d);
|
||||
}
|
||||
|
||||
function clickFeature(d) {
|
||||
function clickFeature(d3_event, d) {
|
||||
context.features().toggle(d);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
import {
|
||||
event as d3_event
|
||||
} from 'd3-selection';
|
||||
|
||||
import { t } from '../../core/localizer';
|
||||
import { uiTooltip } from '../tooltip';
|
||||
import { uiSection } from '../section';
|
||||
@@ -86,12 +82,12 @@ export function uiSectionMapStyleOptions(context) {
|
||||
return context.map().activeAreaFill() === d;
|
||||
}
|
||||
|
||||
function toggleHighlightEdited() {
|
||||
function toggleHighlightEdited(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
context.map().toggleHighlightEdited();
|
||||
}
|
||||
|
||||
function setFill(d) {
|
||||
function setFill(d3_event, d) {
|
||||
context.map().activeAreaFill(d);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import _debounce from 'lodash-es/debounce';
|
||||
import { descending as d3_descending, ascending as d3_ascending } from 'd3-array';
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -49,7 +48,7 @@ export function uiSectionOverlayList(context) {
|
||||
}
|
||||
|
||||
|
||||
function chooseOverlay(d) {
|
||||
function chooseOverlay(d3_event, d) {
|
||||
d3_event.preventDefault();
|
||||
context.background().toggleOverlayLayer(d);
|
||||
_overlayList.call(updateLayerSelections);
|
||||
|
||||
@@ -82,7 +82,7 @@ export function uiSectionPhotoOverlays(context) {
|
||||
labelEnter
|
||||
.append('input')
|
||||
.attr('type', 'checkbox')
|
||||
.on('change', function(d) { toggleLayer(d.id); });
|
||||
.on('change', function(d3_event, d) { toggleLayer(d.id); });
|
||||
|
||||
labelEnter
|
||||
.append('span')
|
||||
@@ -145,7 +145,7 @@ export function uiSectionPhotoOverlays(context) {
|
||||
labelEnter
|
||||
.append('input')
|
||||
.attr('type', 'checkbox')
|
||||
.on('change', function(d) {
|
||||
.on('change', function(d3_event, d) {
|
||||
context.photos().togglePhotoType(d);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import {
|
||||
event as d3_event
|
||||
} from 'd3-selection';
|
||||
|
||||
import { presetManager } from '../../presets';
|
||||
import { t, localizer } from '../../core/localizer';
|
||||
@@ -123,7 +120,7 @@ export function uiSectionPresetFields(context) {
|
||||
|
||||
|
||||
selection.selectAll('.wrap-form-field input')
|
||||
.on('keydown', function() {
|
||||
.on('keydown', function(d3_event) {
|
||||
// if user presses enter, and combobox is not active, accept edits..
|
||||
if (d3_event.keyCode === 13 && // ↩ Return
|
||||
context.container().select('.combobox').empty()) {
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
import {
|
||||
event as d3_event
|
||||
} from 'd3-selection';
|
||||
|
||||
import { prefs } from '../../core/preferences';
|
||||
import { t } from '../../core/localizer';
|
||||
import { uiTooltip } from '../tooltip';
|
||||
@@ -36,7 +32,7 @@ export function uiSectionPrivacy(context) {
|
||||
thirdPartyIconsEnter
|
||||
.append('input')
|
||||
.attr('type', 'checkbox')
|
||||
.on('change', () => {
|
||||
.on('change', (d3_event) => {
|
||||
d3_event.preventDefault();
|
||||
_showThirdPartyIcons = (_showThirdPartyIcons === 'true') ? 'false' : 'true';
|
||||
prefs('preferences.privacy.thirdpartyicons', _showThirdPartyIcons);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { drag as d3_drag } from 'd3-drag';
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -42,7 +41,7 @@ export function uiSectionRawMemberEditor(context) {
|
||||
var _entityIDs;
|
||||
var _maxMembers = 1000;
|
||||
|
||||
function downloadMember(d) {
|
||||
function downloadMember(d3_event, d) {
|
||||
d3_event.preventDefault();
|
||||
|
||||
// display the loading indicator
|
||||
@@ -52,7 +51,7 @@ export function uiSectionRawMemberEditor(context) {
|
||||
});
|
||||
}
|
||||
|
||||
function zoomToMember(d) {
|
||||
function zoomToMember(d3_event, d) {
|
||||
d3_event.preventDefault();
|
||||
|
||||
var entity = context.entity(d.id);
|
||||
@@ -63,7 +62,7 @@ export function uiSectionRawMemberEditor(context) {
|
||||
}
|
||||
|
||||
|
||||
function selectMember(d) {
|
||||
function selectMember(d3_event, d) {
|
||||
d3_event.preventDefault();
|
||||
|
||||
// remove the hover-highlight styling
|
||||
@@ -80,7 +79,7 @@ export function uiSectionRawMemberEditor(context) {
|
||||
}
|
||||
|
||||
|
||||
function changeRole(d) {
|
||||
function changeRole(d3_event, d) {
|
||||
var oldRole = d.role;
|
||||
var newRole = context.cleanRelationRole(d3_select(this).property('value'));
|
||||
|
||||
@@ -95,7 +94,7 @@ export function uiSectionRawMemberEditor(context) {
|
||||
}
|
||||
|
||||
|
||||
function deleteMember(d) {
|
||||
function deleteMember(d3_event, d) {
|
||||
|
||||
// remove the hover-highlight styling
|
||||
utilHighlightEntities([d.id], false, context);
|
||||
@@ -268,14 +267,14 @@ export function uiSectionRawMemberEditor(context) {
|
||||
var dragOrigin, targetIndex;
|
||||
|
||||
items.call(d3_drag()
|
||||
.on('start', function() {
|
||||
.on('start', function(d3_event) {
|
||||
dragOrigin = {
|
||||
x: d3_event.x,
|
||||
y: d3_event.y
|
||||
};
|
||||
targetIndex = null;
|
||||
})
|
||||
.on('drag', function(d, index) {
|
||||
.on('drag', function(d3_event, d, index) {
|
||||
var x = d3_event.x - dragOrigin.x,
|
||||
y = d3_event.y - dragOrigin.y;
|
||||
|
||||
@@ -307,7 +306,7 @@ export function uiSectionRawMemberEditor(context) {
|
||||
return null;
|
||||
});
|
||||
})
|
||||
.on('end', function(d, index) {
|
||||
.on('end', function(d3_event, d, index) {
|
||||
|
||||
if (!d3_select(this).classed('dragging')) {
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -53,7 +52,7 @@ export function uiSectionRawMembershipEditor(context) {
|
||||
var _showBlank;
|
||||
var _maxMemberships = 1000;
|
||||
|
||||
function selectRelation(d) {
|
||||
function selectRelation(d3_event, d) {
|
||||
d3_event.preventDefault();
|
||||
|
||||
// remove the hover-highlight styling
|
||||
@@ -62,7 +61,7 @@ export function uiSectionRawMembershipEditor(context) {
|
||||
context.enter(modeSelect(context, [d.relation.id]));
|
||||
}
|
||||
|
||||
function zoomToRelation(d) {
|
||||
function zoomToRelation(d3_event, d) {
|
||||
d3_event.preventDefault();
|
||||
|
||||
var entity = context.entity(d.relation.id);
|
||||
@@ -73,7 +72,7 @@ export function uiSectionRawMembershipEditor(context) {
|
||||
}
|
||||
|
||||
|
||||
function changeRole(d) {
|
||||
function changeRole(d3_event, d) {
|
||||
if (d === 0) return; // called on newrow (shouldn't happen)
|
||||
if (_inChange) return; // avoid accidental recursive call #5731
|
||||
|
||||
@@ -118,7 +117,7 @@ export function uiSectionRawMembershipEditor(context) {
|
||||
}
|
||||
|
||||
|
||||
function deleteMembership(d) {
|
||||
function deleteMembership(d3_event, d) {
|
||||
this.blur(); // avoid keeping focus on the button
|
||||
if (d === 0) return; // called on newrow (shouldn't happen)
|
||||
|
||||
@@ -242,10 +241,10 @@ export function uiSectionRawMembershipEditor(context) {
|
||||
.attr('class', 'member-row member-row-normal form-field');
|
||||
|
||||
// highlight the relation in the map while hovering on the list item
|
||||
itemsEnter.on('mouseover', function(d) {
|
||||
itemsEnter.on('mouseover', function(d3_event, d) {
|
||||
utilHighlightEntities([d.relation.id], true, context);
|
||||
})
|
||||
.on('mouseout', function(d) {
|
||||
.on('mouseout', function(d3_event, d) {
|
||||
utilHighlightEntities([d.relation.id], false, context);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { services } from '../../services';
|
||||
import { svgIcon } from '../../svg/icon';
|
||||
@@ -95,7 +95,7 @@ export function uiSectionRawTagEditor(id, context) {
|
||||
return 'raw-tag-option raw-tag-option-' + d.id + (_tagView === d.id ? ' selected' : '');
|
||||
})
|
||||
.attr('title', function(d) { return t('icons.' + d.id); })
|
||||
.on('click', function(d) {
|
||||
.on('click', function(d3_event, d) {
|
||||
_tagView = d.id;
|
||||
prefs('raw-tag-editor-view', d.id);
|
||||
|
||||
@@ -372,7 +372,7 @@ export function uiSectionRawTagEditor(id, context) {
|
||||
scheduleChange();
|
||||
}
|
||||
|
||||
function pushMore() {
|
||||
function pushMore(d3_event) {
|
||||
// if pressing Tab on the last value field with content, add a blank row
|
||||
if (d3_event.keyCode === 9 && !d3_event.shiftKey &&
|
||||
section.selection().selectAll('.tag-list li:last-child input.value').node() === this &&
|
||||
@@ -454,7 +454,7 @@ export function uiSectionRawTagEditor(id, context) {
|
||||
.call(uiCombobox.off, context);
|
||||
}
|
||||
|
||||
function keyChange(d) {
|
||||
function keyChange(d3_event, d) {
|
||||
if (d3_select(this).attr('readonly')) return;
|
||||
|
||||
var kOld = d.key;
|
||||
@@ -512,7 +512,7 @@ export function uiSectionRawTagEditor(id, context) {
|
||||
scheduleChange();
|
||||
}
|
||||
|
||||
function valueChange(d) {
|
||||
function valueChange(d3_event, d) {
|
||||
if (isReadOnly(d)) return;
|
||||
|
||||
// exit if this is a multiselection and no value was entered
|
||||
@@ -527,7 +527,7 @@ export function uiSectionRawTagEditor(id, context) {
|
||||
scheduleChange();
|
||||
}
|
||||
|
||||
function removeTag(d) {
|
||||
function removeTag(d3_event, d) {
|
||||
if (isReadOnly(d)) return;
|
||||
|
||||
if (d.key === '') { // removing the blank row
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { presetManager } from '../../presets';
|
||||
import { modeSelect } from '../../modes/select';
|
||||
@@ -34,11 +34,11 @@ export function uiSectionSelectionList(context) {
|
||||
return section;
|
||||
};
|
||||
|
||||
function selectEntity(entity) {
|
||||
function selectEntity(d3_event, entity) {
|
||||
context.enter(modeSelect(context, [entity.id]));
|
||||
}
|
||||
|
||||
function deselectEntity(entity) {
|
||||
function deselectEntity(d3_event, entity) {
|
||||
d3_event.stopPropagation();
|
||||
|
||||
var selectedIDs = _selectedIDs.slice();
|
||||
|
||||
@@ -127,7 +127,7 @@ export function uiSectionValidationIssues(id, severity, context) {
|
||||
.attr('title', t('issues.fix_one.title'))
|
||||
.datum(d.autoFix) // set button datum to the autofix
|
||||
.attr('class', 'autofix action')
|
||||
.on('click', function(d) {
|
||||
.on('click', function(d3_event, d) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
import {
|
||||
event as d3_event
|
||||
} from 'd3-selection';
|
||||
|
||||
import { prefs } from '../../core/preferences';
|
||||
import { t } from '../../core/localizer';
|
||||
import { uiSection } from '../section';
|
||||
@@ -51,7 +47,7 @@ export function uiSectionValidationOptions(context) {
|
||||
.attr('name', function(d) { return 'issues-option-' + d.key; })
|
||||
.attr('value', function(d) { return d.value; })
|
||||
.property('checked', function(d) { return getOptions()[d.key] === d.value; })
|
||||
.on('change', function(d) { updateOptionValue(d.key, d.value); });
|
||||
.on('change', function(d3_event, d) { updateOptionValue(d3_event, d.key, d.value); });
|
||||
|
||||
valuesEnter
|
||||
.append('span')
|
||||
@@ -65,7 +61,7 @@ export function uiSectionValidationOptions(context) {
|
||||
};
|
||||
}
|
||||
|
||||
function updateOptionValue(d, val) {
|
||||
function updateOptionValue(d3_event, d, val) {
|
||||
if (!val && d3_event && d3_event.target) {
|
||||
val = d3_event.target.value;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -138,12 +137,12 @@ export function uiSectionValidationRules(context) {
|
||||
.attr('step', '0.5')
|
||||
.attr('class', 'square-degrees-input')
|
||||
.call(utilNoAuto)
|
||||
.on('click', function () {
|
||||
.on('click', function (d3_event) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
this.select();
|
||||
})
|
||||
.on('keyup', function () {
|
||||
.on('keyup', function (d3_event) {
|
||||
if (d3_event.keyCode === 13) { // ↩ Return
|
||||
this.blur();
|
||||
this.select();
|
||||
@@ -181,7 +180,7 @@ export function uiSectionValidationRules(context) {
|
||||
return context.validator().isRuleEnabled(d);
|
||||
}
|
||||
|
||||
function toggleRule(d) {
|
||||
function toggleRule(d3_event, d) {
|
||||
context.validator().toggleRule(d);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
|
||||
import { prefs } from '../../core/preferences';
|
||||
import { t } from '../../core/localizer';
|
||||
@@ -46,7 +45,7 @@ export function uiSettingsCustomData(context) {
|
||||
.attr('class', 'field-file')
|
||||
.attr('type', 'file')
|
||||
.property('files', _currSettings.fileList) // works for all except IE11
|
||||
.on('change', function() {
|
||||
.on('change', function(d3_event) {
|
||||
var files = d3_event.target.files;
|
||||
if (files && files.length) {
|
||||
_currSettings.url = '';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { event as d3_event, select as d3_select } from 'd3-selection';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { fileFetcher } from '../core/file_fetcher';
|
||||
import { t } from '../core/localizer';
|
||||
@@ -63,8 +63,9 @@ export function uiShortcuts(context) {
|
||||
.append('a')
|
||||
.attr('class', 'tab')
|
||||
.attr('href', '#')
|
||||
.on('click', function (d, i) {
|
||||
.on('click', function (d3_event) {
|
||||
d3_event.preventDefault();
|
||||
var i = tabs.nodes().indexOf(this);
|
||||
_activeTab = i;
|
||||
render(selection, dataShortcuts);
|
||||
});
|
||||
|
||||
@@ -2,7 +2,6 @@ import _throttle from 'lodash-es/throttle';
|
||||
|
||||
import { interpolateNumber as d3_interpolateNumber } from 'd3-interpolate';
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -56,7 +55,7 @@ export function uiSidebar(context) {
|
||||
|
||||
var downPointerId, lastClientX, containerLocGetter;
|
||||
|
||||
function pointerdown() {
|
||||
function pointerdown(d3_event) {
|
||||
if (downPointerId) return;
|
||||
|
||||
if ('button' in d3_event && d3_event.button !== 0) return;
|
||||
@@ -80,7 +79,7 @@ export function uiSidebar(context) {
|
||||
resizer.classed('dragging', true);
|
||||
|
||||
d3_select(window)
|
||||
.on('touchmove.sidebar-resizer', function() {
|
||||
.on('touchmove.sidebar-resizer', function(d3_event) {
|
||||
// disable page scrolling while resizing on touch input
|
||||
d3_event.preventDefault();
|
||||
}, { passive: false })
|
||||
@@ -88,7 +87,7 @@ export function uiSidebar(context) {
|
||||
.on(_pointerPrefix + 'up.sidebar-resizer pointercancel.sidebar-resizer', pointerup);
|
||||
}
|
||||
|
||||
function pointermove() {
|
||||
function pointermove(d3_event) {
|
||||
|
||||
if (downPointerId !== (d3_event.pointerId || 'mouse')) return;
|
||||
|
||||
@@ -133,7 +132,7 @@ export function uiSidebar(context) {
|
||||
}
|
||||
}
|
||||
|
||||
function pointerup() {
|
||||
function pointerup(d3_event) {
|
||||
if (downPointerId !== (d3_event.pointerId || 'mouse')) return;
|
||||
|
||||
downPointerId = null;
|
||||
@@ -355,7 +354,7 @@ export function uiSidebar(context) {
|
||||
};
|
||||
|
||||
|
||||
sidebar.toggle = function(moveMap) {
|
||||
sidebar.toggle = function(d3_event, moveMap) {
|
||||
var e = d3_event;
|
||||
if (e && e.sourceEvent) {
|
||||
e.sourceEvent.preventDefault();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -11,7 +10,7 @@ export function uiSourceSwitch(context) {
|
||||
var keys;
|
||||
|
||||
|
||||
function click() {
|
||||
function click(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
|
||||
var osm = context.connection();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import _throttle from 'lodash-es/throttle';
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
|
||||
import { t } from '../core/localizer';
|
||||
import { svgIcon } from '../svg/icon';
|
||||
@@ -30,7 +29,7 @@ export function uiStatus(context) {
|
||||
.call(svgIcon('#iD-icon-out-link', 'inline'))
|
||||
.append('span')
|
||||
.html(t.html('login'))
|
||||
.on('click.login', function() {
|
||||
.on('click.login', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
osm.authenticate();
|
||||
});
|
||||
@@ -51,7 +50,7 @@ export function uiStatus(context) {
|
||||
.append('a')
|
||||
// let the user manually retry their connection directly
|
||||
.html(t.html('osm_api_status.retry'))
|
||||
.on('click.retry', function() {
|
||||
.on('click.retry', function(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
throttledRetry();
|
||||
});
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
@@ -155,7 +154,7 @@ export function uiTagReference(what) {
|
||||
.merge(_button);
|
||||
|
||||
_button
|
||||
.on('click', function () {
|
||||
.on('click', function (d3_event) {
|
||||
d3_event.stopPropagation();
|
||||
d3_event.preventDefault();
|
||||
this.blur(); // avoid keeping focus on the button - #4641
|
||||
|
||||
@@ -98,7 +98,7 @@ export function uiToolOldDrawModes(context) {
|
||||
var buttonsEnter = buttons.enter()
|
||||
.append('button')
|
||||
.attr('class', function(d) { return d.id + ' add-button bar-button'; })
|
||||
.on('click.mode-buttons', function(d) {
|
||||
.on('click.mode-buttons', function(d3_event, d) {
|
||||
if (!enabled(d)) return;
|
||||
|
||||
// When drawing, ignore accidental clicks on mode buttons - #4042
|
||||
|
||||
@@ -46,7 +46,6 @@ export function uiToolNotes(context) {
|
||||
|
||||
tool.render = function(selection) {
|
||||
|
||||
|
||||
var debouncedUpdate = _debounce(update, 500, { leading: true, trailing: true });
|
||||
|
||||
context.map()
|
||||
@@ -74,7 +73,7 @@ export function uiToolNotes(context) {
|
||||
var buttonsEnter = buttons.enter()
|
||||
.append('button')
|
||||
.attr('class', function(d) { return d.id + ' add-button bar-button'; })
|
||||
.on('click.notes', function(d) {
|
||||
.on('click.notes', function(d3_event, d) {
|
||||
if (!enabled(d)) return;
|
||||
|
||||
// When drawing, ignore accidental clicks on mode buttons - #4042
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { interpolateRgb as d3_interpolateRgb } from 'd3-interpolate';
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
|
||||
import { t } from '../../core/localizer';
|
||||
import { modeSave } from '../../modes';
|
||||
@@ -30,7 +29,7 @@ export function uiToolSave(context) {
|
||||
return _numChanges === 0 || isSaving();
|
||||
}
|
||||
|
||||
function save() {
|
||||
function save(d3_event) {
|
||||
d3_event.preventDefault();
|
||||
if (!context.inIntro() && !isSaving() && history.hasChanges()) {
|
||||
context.enter(modeSave(context));
|
||||
@@ -85,13 +84,11 @@ export function uiToolSave(context) {
|
||||
button = selection
|
||||
.append('button')
|
||||
.attr('class', 'save disabled bar-button')
|
||||
.on('pointerup', function() {
|
||||
.on('pointerup', function(d3_event) {
|
||||
lastPointerUpType = d3_event.pointerType;
|
||||
})
|
||||
.on('click', function() {
|
||||
d3_event.preventDefault();
|
||||
|
||||
save();
|
||||
.on('click', function(d3_event) {
|
||||
save(d3_event);
|
||||
|
||||
if (_numChanges === 0 && (
|
||||
lastPointerUpType === 'touch' ||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user