mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 23:44:47 +02:00
Merge branch 'develop' into photo-filter-temp
This commit is contained in:
+5
-1
@@ -1,7 +1,11 @@
|
||||
{
|
||||
"presets": [
|
||||
[
|
||||
"@babel/env"
|
||||
"@babel/preset-env", {
|
||||
"useBuiltIns": "usage",
|
||||
"corejs": 3,
|
||||
"modules": false
|
||||
}
|
||||
]
|
||||
],
|
||||
"compact": false
|
||||
|
||||
@@ -29,7 +29,9 @@ export default {
|
||||
commonjs(),
|
||||
json({ indent: '' }),
|
||||
babel({
|
||||
babelHelpers: 'bundled'
|
||||
babelHelpers: 'bundled',
|
||||
// avoid circular dependencies due to `useBuiltIns: usage` option
|
||||
exclude: [/\/core-js\//]
|
||||
})
|
||||
]
|
||||
};
|
||||
|
||||
+10
-3
@@ -73,7 +73,9 @@ en:
|
||||
cancel_draw:
|
||||
annotation: Canceled drawing.
|
||||
change_role:
|
||||
annotation: Changed the role of a relation member.
|
||||
annotation:
|
||||
one: Changed the role of a relation member.
|
||||
other: "Changed the roles of {n} relation members."
|
||||
change_tags:
|
||||
annotation: Changed tags.
|
||||
copy:
|
||||
@@ -242,9 +244,13 @@ en:
|
||||
single: This feature can't be downgraded because it has a Wikidata tag.
|
||||
multiple: These features can't be downgraded because some have Wikidata tags.
|
||||
add_member:
|
||||
annotation: Added a member to a relation.
|
||||
annotation:
|
||||
one: Added a member to a relation.
|
||||
other: "Added {n} members to a relation."
|
||||
delete_member:
|
||||
annotation: Removed a member from a relation.
|
||||
annotation:
|
||||
one: Removed a member from a relation.
|
||||
other: "Removed {n} members from a relation."
|
||||
reorder_members:
|
||||
annotation: Reordered a relation's members.
|
||||
connect:
|
||||
@@ -683,6 +689,7 @@ en:
|
||||
new_relation: New relation...
|
||||
choose_relation: Choose a parent relation
|
||||
role: Role
|
||||
multiple_roles: Multiple Roles
|
||||
choose: Select feature type
|
||||
results:
|
||||
one: "{n} result for {search}"
|
||||
|
||||
@@ -1484,7 +1484,7 @@
|
||||
},
|
||||
{
|
||||
"old": {"type": "audio", "amenity": "studio"},
|
||||
"replace": {"studio": "audio"}
|
||||
"replace": {"studio": "audio", "amenity": "studio"}
|
||||
},
|
||||
{
|
||||
"old": {"type": "broad_leaved"},
|
||||
@@ -1544,7 +1544,7 @@
|
||||
},
|
||||
{
|
||||
"old": {"type": "video", "amenity": "studio"},
|
||||
"replace": {"studio": "video"}
|
||||
"replace": {"studio": "video", "amenity": "studio"}
|
||||
},
|
||||
{
|
||||
"old": {"type": "water", "man_made": "pipeline"},
|
||||
|
||||
@@ -378,14 +378,18 @@ For combo fields, spaces are replaced with underscores in the tag value if `snak
|
||||
|
||||
For combo fields, case-sensitive field values are allowed if `caseSensitive` is `true`. The default is `false`.
|
||||
|
||||
##### `min_value`
|
||||
##### `minValue`
|
||||
|
||||
For number fields, the lowest valid value. There is no default.
|
||||
|
||||
##### `max_value`
|
||||
##### `maxValue`
|
||||
|
||||
For number fields, the greatest valid value. There is no default.
|
||||
|
||||
##### `increment`
|
||||
|
||||
For number fields, the amount the stepper control increases or decreases the value. The default is `1`.
|
||||
|
||||
##### `prerequisiteTag`
|
||||
|
||||
An object defining the tags the feature needs before this field will be displayed. It may have this property:
|
||||
|
||||
@@ -131,10 +131,10 @@
|
||||
"diplomatic/services": {"key": "diplomatic:services:", "type": "multiCombo", "label": "Services"},
|
||||
"direction_cardinal": {"key": "direction", "type": "combo", "label": "Direction", "strings": {"options": {"N": "North", "E": "East", "S": "South", "W": "West", "NE": "Northeast", "SE": "Southeast", "SW": "Southwest", "NW": "Northwest", "NNE": "North-northeast", "ENE": "East-northeast", "ESE": "East-southeast", "SSE": "South-southeast", "SSW": "South-southwest", "WSW": "West-southwest", "WNW": "West-northwest", "NNW": "North-northwest"}}},
|
||||
"direction_clock": {"key": "direction", "type": "combo", "label": "Direction", "strings": {"options": {"clockwise": "Clockwise", "anticlockwise": "Counterclockwise"}}},
|
||||
"direction_point": {"key": "direction", "type": "number", "label": "Direction (Degrees Clockwise)", "placeholder": "45, 90, 180, 270", "geometry": ["point"]},
|
||||
"direction_point": {"key": "direction", "type": "number", "label": "Direction (Degrees Clockwise)", "placeholder": "45, 90, 180, 270", "increment": 5, "geometry": ["point"]},
|
||||
"direction_vertex_dual": {"key": "direction", "type": "combo", "label": "Direction Affected", "strings": {"options": {"forward": "Forward", "backward": "Backward"}}},
|
||||
"direction_vertex": {"key": "direction", "type": "combo", "label": "Direction Affected", "strings": {"options": {"forward": "Forward", "backward": "Backward", "both": "Both / All"}}},
|
||||
"direction": {"key": "direction", "type": "number", "label": "Direction (Degrees Clockwise)", "placeholder": "45, 90, 180, 270"},
|
||||
"direction": {"key": "direction", "type": "number", "label": "Direction (Degrees Clockwise)", "increment": 5, "placeholder": "45, 90, 180, 270"},
|
||||
"dispensing": {"key": "dispensing", "type": "check", "label": "Dispenses Prescriptions", "default": "yes"},
|
||||
"display": {"key": "display", "type": "combo", "label": "Display", "options": ["analog", "digital", "sundial", "unorthodox"]},
|
||||
"distance": {"key": "distance", "type": "text", "label": "Distance", "terms": ["length", "mileage"]},
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
"key": "direction",
|
||||
"type": "number",
|
||||
"label": "Direction (Degrees Clockwise)",
|
||||
"increment": 5,
|
||||
"placeholder": "45, 90, 180, 270"
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"type": "number",
|
||||
"label": "Direction (Degrees Clockwise)",
|
||||
"placeholder": "45, 90, 180, 270",
|
||||
"increment": 5,
|
||||
"geometry": [
|
||||
"point"
|
||||
]
|
||||
|
||||
@@ -1348,7 +1348,7 @@
|
||||
"waterway/sanitary_dump_station": {"icon": "temaki-waste", "fields": ["name", "operator", "access_simple", "fee", "payment_multi_fee", "charge_fee", "water_point"], "moreFields": ["opening_hours", "opening_hours/covid19", "seamark/type"], "geometry": ["point", "vertex", "area"], "terms": ["Boat", "Watercraft", "Sanitary", "Dump Station", "Pumpout", "Pump out", "Elsan", "CDP", "CTDP", "Chemical Toilet"], "tags": {"waterway": "sanitary_dump_station"}, "name": "Marine Toilet Disposal"},
|
||||
"waterway/stream_intermittent": {"icon": "iD-waterway-stream", "fields": ["{waterway/stream}"], "moreFields": ["{waterway/stream}"], "geometry": ["line"], "terms": ["arroyo", "beck", "branch", "brook", "burn", "course", "creek", "drift", "flood", "flow", "gully", "run", "runnel", "rush", "spate", "spritz", "tributary", "wadi", "wash", "watercourse"], "tags": {"waterway": "stream", "intermittent": "yes"}, "reference": {"key": "waterway", "value": "stream"}, "name": "Intermittent Stream"},
|
||||
"waterway/stream": {"icon": "iD-waterway-stream", "fields": ["name", "structure_waterway", "width", "intermittent"], "moreFields": ["covered", "fishing", "gnis/feature_id", "salt", "tidal"], "geometry": ["line"], "terms": ["beck", "branch", "brook", "burn", "course", "creek", "current", "drift", "flood", "flow", "freshet", "race", "rill", "rindle", "rivulet", "run", "runnel", "rush", "spate", "spritz", "surge", "tide", "torrent", "tributary", "watercourse"], "tags": {"waterway": "stream"}, "name": "Stream"},
|
||||
"waterway/tidal_channel": {"icon": "iD-waterway-stream", "fields": ["name", "structure_waterway", "width", "salt", "tidal", "intermittent"], "moreFields": ["covered", "fishing", "gnis/feature_id"], "geometry": ["line"], "terms": ["coastal", "pill", "intertidal", "mangroves", "marine", "salt marsh", "tidal creek", "tidal flat", "tidal inlet", "waterway"], "tags": {"waterway": "tidal_channel"}, "addTags": {"waterway": "tidal_channel", "tidal": "yes"}, "name": "Tidal Channel"},
|
||||
"waterway/tidal_channel": {"icon": "iD-waterway-stream", "fields": ["name", "structure_waterway", "width", "salt", "tidal", "intermittent"], "moreFields": ["covered", "fishing", "gnis/feature_id"], "geometry": ["line"], "terms": ["coastal", "pill", "intertidal", "mangroves", "marine", "salt marsh", "tidal creek", "tidal flat", "tidal inlet", "waterway"], "tags": {"waterway": "tidal_channel"}, "name": "Tidal Channel"},
|
||||
"waterway/water_point": {"icon": "maki-drinking-water", "fields": ["{amenity/water_point}"], "moreFields": ["{amenity/water_point}"], "geometry": ["point", "vertex", "area"], "tags": {"waterway": "water_point"}, "terms": ["water faucet", "water point", "water tap", "water source", "water spigot"], "name": "Marine Drinking Water"},
|
||||
"waterway/waterfall": {"icon": "maki-waterfall", "fields": ["name", "height", "width", "intermittent"], "moreFields": ["gnis/feature_id"], "geometry": ["vertex"], "terms": ["fall"], "tags": {"waterway": "waterfall"}, "name": "Waterfall"},
|
||||
"waterway/weir": {"icon": "maki-dam", "fields": ["name", "operator", "height", "material"], "moreFields": ["gnis/feature_id", "seamark/type"], "geometry": ["vertex", "line"], "terms": ["low-head dam", "low-rise dam", "wier"], "tags": {"waterway": "weir"}, "name": "Weir"},
|
||||
|
||||
@@ -31,9 +31,5 @@
|
||||
"tags": {
|
||||
"waterway": "tidal_channel"
|
||||
},
|
||||
"addTags": {
|
||||
"waterway": "tidal_channel",
|
||||
"tidal": "yes"
|
||||
},
|
||||
"name": "Tidal Channel"
|
||||
}
|
||||
|
||||
@@ -148,6 +148,11 @@
|
||||
"description": "Maximum field value (number fields only)",
|
||||
"type": "integer"
|
||||
},
|
||||
"increment": {
|
||||
"description": "The amount the stepper control should add or subtract (number fields only)",
|
||||
"minimum": 1,
|
||||
"type": "integer"
|
||||
},
|
||||
"prerequisiteTag": {
|
||||
"description": "Tagging constraint for showing this field in the editor",
|
||||
"type": {
|
||||
|
||||
Vendored
+13
-3
@@ -94,7 +94,10 @@
|
||||
"annotation": "Canceled drawing."
|
||||
},
|
||||
"change_role": {
|
||||
"annotation": "Changed the role of a relation member."
|
||||
"annotation": {
|
||||
"one": "Changed the role of a relation member.",
|
||||
"other": "Changed the roles of {n} relation members."
|
||||
}
|
||||
},
|
||||
"change_tags": {
|
||||
"annotation": "Changed tags."
|
||||
@@ -323,10 +326,16 @@
|
||||
}
|
||||
},
|
||||
"add_member": {
|
||||
"annotation": "Added a member to a relation."
|
||||
"annotation": {
|
||||
"one": "Added a member to a relation.",
|
||||
"other": "Added {n} members to a relation."
|
||||
}
|
||||
},
|
||||
"delete_member": {
|
||||
"annotation": "Removed a member from a relation."
|
||||
"annotation": {
|
||||
"one": "Removed a member from a relation.",
|
||||
"other": "Removed {n} members from a relation."
|
||||
}
|
||||
},
|
||||
"reorder_members": {
|
||||
"annotation": "Reordered a relation's members."
|
||||
@@ -882,6 +891,7 @@
|
||||
"new_relation": "New relation...",
|
||||
"choose_relation": "Choose a parent relation",
|
||||
"role": "Role",
|
||||
"multiple_roles": "Multiple Roles",
|
||||
"choose": "Select feature type",
|
||||
"results": {
|
||||
"one": "{n} result for {search}",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,14 @@
|
||||
import { actionDeleteMember } from './delete_member';
|
||||
|
||||
|
||||
export function actionDeleteMembers(relationId, memberIndexes) {
|
||||
return function(graph) {
|
||||
// Remove the members in descending order so removals won't shift what members
|
||||
// are at the remaining indexes
|
||||
memberIndexes.sort((a, b) => b - a);
|
||||
for (var i in memberIndexes) {
|
||||
graph = actionDeleteMember(relationId, memberIndexes[i])(graph);
|
||||
}
|
||||
return graph;
|
||||
};
|
||||
}
|
||||
+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);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
-4
@@ -1,8 +1,8 @@
|
||||
import 'browser-polyfills';
|
||||
import 'string.fromcodepoint/auto';
|
||||
// polyfill window.fetch and AbortController (not included in core-js)
|
||||
import 'whatwg-fetch';
|
||||
import 'abortcontroller-polyfill/dist/polyfill-patch-fetch';
|
||||
|
||||
// polyfill requestIdleCallback
|
||||
// polyfill idle callback functions (not included in core-js)
|
||||
window.requestIdleCallback = window.requestIdleCallback ||
|
||||
function(cb) {
|
||||
var start = Date.now();
|
||||
@@ -15,7 +15,6 @@ window.requestIdleCallback = window.requestIdleCallback ||
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
window.cancelIdleCallback = window.cancelIdleCallback ||
|
||||
function(id) {
|
||||
window.cancelAnimationFrame(id);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -34,6 +34,7 @@ export function presetField(fieldID, field) {
|
||||
_this.terms = () => _this.t('terms', { 'default': _this.originalTerms })
|
||||
.toLowerCase().trim().split(/\s*,+\s*/);
|
||||
|
||||
_this.increment = _this.type === 'number' ? (_this.increment || 1) : undefined;
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
+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';
|
||||
@@ -309,7 +308,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';
|
||||
|
||||
@@ -770,7 +769,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();
|
||||
|
||||
|
||||
+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';
|
||||
|
||||
@@ -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,11 +220,11 @@ 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) {
|
||||
d3_event.preventDefault();
|
||||
|
||||
var container = parent.selectAll('.conflict-container');
|
||||
var sign = (i === 0 ? -1 : 1);
|
||||
var sign = (d === 'previous' ? -1 : 1);
|
||||
|
||||
container
|
||||
.selectAll('.conflict')
|
||||
@@ -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) {
|
||||
var ul = this.parentNode.parentNode.parentNode;
|
||||
ul.__data__.chosen = i;
|
||||
choose(ul, d);
|
||||
ul.__data__.chosen = d.id;
|
||||
choose(d3_event, ul, d);
|
||||
});
|
||||
|
||||
labelEnter
|
||||
@@ -270,16 +269,16 @@ export function uiConflicts(context) {
|
||||
// update
|
||||
choicesEnter
|
||||
.merge(choices)
|
||||
.each(function(d, i) {
|
||||
.each(function(d) {
|
||||
var ul = this.parentNode;
|
||||
if (ul.__data__.chosen === i) {
|
||||
choose(ul, d);
|
||||
if (ul.__data__.chosen === d.id) {
|
||||
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,10 +219,10 @@ 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) {
|
||||
d3_event.stopPropagation();
|
||||
d3_event.preventDefault();
|
||||
clickHelp(i);
|
||||
clickHelp(titles.indexOf(d));
|
||||
});
|
||||
|
||||
enter
|
||||
|
||||
@@ -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) {
|
||||
var x = d3_event.x - dragOrigin.x,
|
||||
y = d3_event.y - dragOrigin.y;
|
||||
|
||||
@@ -583,6 +583,8 @@ export function uiFieldCombo(field, context) {
|
||||
// don't display drag until dragging beyond a distance threshold
|
||||
Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5) return;
|
||||
|
||||
var index = selection.nodes().indexOf(this);
|
||||
|
||||
d3_select(this)
|
||||
.classed('dragging', true);
|
||||
|
||||
@@ -648,10 +650,11 @@ export function uiFieldCombo(field, context) {
|
||||
});
|
||||
}
|
||||
})
|
||||
.on('end', function(d, index) {
|
||||
.on('end', function() {
|
||||
if (!d3_select(this).classed('dragging')) {
|
||||
return;
|
||||
}
|
||||
var index = selection.nodes().indexOf(this);
|
||||
|
||||
d3_select(this)
|
||||
.classed('dragging', false);
|
||||
|
||||
@@ -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';
|
||||
@@ -75,17 +75,19 @@ export function uiFieldText(field, context) {
|
||||
|
||||
input.attr('type', 'text');
|
||||
|
||||
var inc = field.increment;
|
||||
|
||||
var buttons = wrap.selectAll('.increment, .decrement')
|
||||
.data(rtl ? [1, -1] : [-1, 1]);
|
||||
.data(rtl ? [inc, -inc] : [-inc, inc]);
|
||||
|
||||
buttons.enter()
|
||||
.append('button')
|
||||
.attr('class', function(d) {
|
||||
var which = (d === 1 ? 'increment' : 'decrement');
|
||||
var which = (d > 0 ? 'increment' : 'decrement');
|
||||
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 +117,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;
|
||||
@@ -390,7 +390,7 @@ export function uiFieldLocalized(field, context) {
|
||||
}
|
||||
|
||||
|
||||
function changeLang(d) {
|
||||
function changeLang(d3_event, d) {
|
||||
var tags = {};
|
||||
|
||||
// make sure unrecognized suffixes are lowercase - #7156
|
||||
@@ -422,7 +422,7 @@ export function uiFieldLocalized(field, context) {
|
||||
}
|
||||
|
||||
|
||||
function changeValue(d) {
|
||||
function changeValue(d3_event, d) {
|
||||
if (!d.lang) return;
|
||||
var value = context.cleanTagValue(utilGetSetValue(d3_select(this))) || undefined;
|
||||
|
||||
@@ -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) {
|
||||
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);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+12
-11
@@ -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;
|
||||
@@ -344,12 +343,14 @@ export function uiInit(context) {
|
||||
};
|
||||
|
||||
d3_select(window)
|
||||
.on('resize.editor', ui.onResize);
|
||||
.on('resize.editor', function() {
|
||||
ui.onResize();
|
||||
});
|
||||
|
||||
|
||||
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 +360,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 +373,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 +394,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 +445,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';
|
||||
|
||||
@@ -163,7 +162,7 @@ export function uiNoteEditor(context) {
|
||||
.on('input.note-input', changeInput)
|
||||
.on('blur.note-input', changeInput);
|
||||
|
||||
if (_newNote) {
|
||||
if (!commentTextarea.empty() && _newNote) {
|
||||
// autofocus the comment field for new notes
|
||||
commentTextarea.node().focus();
|
||||
}
|
||||
@@ -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';
|
||||
@@ -283,7 +280,7 @@ export function uiPaneHelp(context) {
|
||||
helpPane.renderContent = function(content) {
|
||||
|
||||
function clickHelp(d, i) {
|
||||
if (d3_event) d3_event.preventDefault();
|
||||
|
||||
var rtl = (localizer.textDirection() === 'rtl');
|
||||
content.property('scrollTop', 0);
|
||||
helpPane.selection().select('.pane-heading h2').html(d.title);
|
||||
@@ -309,7 +306,7 @@ 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);
|
||||
});
|
||||
@@ -328,7 +325,7 @@ 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);
|
||||
});
|
||||
@@ -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);
|
||||
}
|
||||
@@ -366,7 +363,10 @@ export function uiPaneHelp(context) {
|
||||
.append('a')
|
||||
.attr('href', '#')
|
||||
.html(function(d) { return d.title; })
|
||||
.on('click', clickHelp);
|
||||
.on('click', function(d3_event, d) {
|
||||
d3_event.preventDefault();
|
||||
clickHelp(d, docs.indexOf(d));
|
||||
});
|
||||
|
||||
var shortcuts = toc
|
||||
.append('li')
|
||||
@@ -415,7 +415,6 @@ export function uiPaneHelp(context) {
|
||||
.attr('class', 'nav');
|
||||
|
||||
clickHelp(docs[0], 0);
|
||||
|
||||
};
|
||||
|
||||
return helpPane;
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -37,10 +36,6 @@ export function uiSectionBackgroundDisplayOptions(context) {
|
||||
}
|
||||
|
||||
function updateValue(d, val) {
|
||||
if (!val && d3_event && d3_event.target) {
|
||||
val = d3_event.target.value;
|
||||
}
|
||||
|
||||
val = clamp(val, _minVal, _maxVal);
|
||||
|
||||
_options[d] = val;
|
||||
@@ -85,8 +80,11 @@ 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');
|
||||
if (!val && d3_event && d3_event.target) {
|
||||
val = d3_event.target.value;
|
||||
}
|
||||
updateValue(d, val);
|
||||
});
|
||||
|
||||
@@ -94,7 +92,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);
|
||||
})
|
||||
@@ -108,7 +106,7 @@ export function uiSectionBackgroundDisplayOptions(context) {
|
||||
.html(t.html('background.reset_all'))
|
||||
.on('click', function() {
|
||||
for (var i = 0; i < _sliders.length; i++) {
|
||||
updateValue(_sliders[i],1);
|
||||
updateValue(_sliders[i], 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);
|
||||
|
||||
@@ -84,7 +84,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')
|
||||
@@ -146,7 +146,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);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user