mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Add error feedback text when attempting to draw self-intersecting ways
This commit is contained in:
@@ -837,6 +837,10 @@ en:
|
||||
out: Zoom Out
|
||||
cannot_zoom: "Cannot zoom out further in current mode."
|
||||
full_screen: Toggle Full Screen
|
||||
self_intersection:
|
||||
error:
|
||||
lines: Lines cannot cross over themselves.
|
||||
areas: Areas cannot cross over themselves.
|
||||
QA:
|
||||
osmose:
|
||||
title: Osmose Issue
|
||||
|
||||
Vendored
+6
@@ -1047,6 +1047,12 @@
|
||||
},
|
||||
"cannot_zoom": "Cannot zoom out further in current mode.",
|
||||
"full_screen": "Toggle Full Screen",
|
||||
"self_intersection": {
|
||||
"error": {
|
||||
"lines": "Lines cannot cross over themselves.",
|
||||
"areas": "Areas cannot cross over themselves."
|
||||
}
|
||||
},
|
||||
"QA": {
|
||||
"osmose": {
|
||||
"title": "Osmose Issue",
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
|
||||
import {
|
||||
event as d3_event,
|
||||
select as d3_select
|
||||
@@ -12,10 +14,13 @@ import { geoChooseEdge, geoHasSelfIntersections } from '../geo';
|
||||
import { modeBrowse } from '../modes/browse';
|
||||
import { modeSelect } from '../modes/select';
|
||||
import { osmNode } from '../osm/node';
|
||||
import { utilRebind } from '../util/rebind';
|
||||
import { utilKeybinding } from '../util';
|
||||
|
||||
export function behaviorDrawWay(context, wayID, index, mode, startGraph, baselineGraph) {
|
||||
|
||||
var dispatch = d3_dispatch('rejectedSelfIntersection');
|
||||
|
||||
var _origWay = context.entity(wayID);
|
||||
|
||||
var _annotation = t((_origWay.isDegenerate() ?
|
||||
@@ -281,6 +286,7 @@ export function behaviorDrawWay(context, wayID, index, mode, startGraph, baselin
|
||||
// Accept the current position of the drawing node and continue drawing.
|
||||
drawWay.add = function(loc, d) {
|
||||
if ((d && d.properties && d.properties.nope) || context.surface().classed('nope')) {
|
||||
dispatch.call('rejectedSelfIntersection', this);
|
||||
return; // can't click here
|
||||
}
|
||||
|
||||
@@ -308,6 +314,7 @@ export function behaviorDrawWay(context, wayID, index, mode, startGraph, baselin
|
||||
// Connect the way to an existing way.
|
||||
drawWay.addWay = function(loc, edge, d) {
|
||||
if ((d && d.properties && d.properties.nope) || context.surface().classed('nope')) {
|
||||
dispatch.call('rejectedSelfIntersection', this);
|
||||
return; // can't click here
|
||||
}
|
||||
|
||||
@@ -332,6 +339,7 @@ export function behaviorDrawWay(context, wayID, index, mode, startGraph, baselin
|
||||
// Connect the way to an existing node and continue drawing.
|
||||
drawWay.addNode = function(node, d) {
|
||||
if ((d && d.properties && d.properties.nope) || context.surface().classed('nope')) {
|
||||
dispatch.call('rejectedSelfIntersection', this);
|
||||
return; // can't click here
|
||||
}
|
||||
|
||||
@@ -417,5 +425,5 @@ export function behaviorDrawWay(context, wayID, index, mode, startGraph, baselin
|
||||
};
|
||||
|
||||
|
||||
return drawWay;
|
||||
return utilRebind(drawWay, dispatch, 'on');
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { t } from '../util/locale';
|
||||
import { behaviorDrawWay } from '../behavior/draw_way';
|
||||
import { uiFlash } from '../ui/flash';
|
||||
|
||||
|
||||
export function modeDrawArea(context, wayID, startGraph, baselineGraph, button) {
|
||||
@@ -16,7 +17,11 @@ export function modeDrawArea(context, wayID, startGraph, baselineGraph, button)
|
||||
var way = context.entity(wayID);
|
||||
|
||||
behavior = behaviorDrawWay(context, wayID, undefined, mode, startGraph, baselineGraph)
|
||||
.tail(t('modes.draw_area.tail'));
|
||||
.tail(t('modes.draw_area.tail'))
|
||||
.on('rejectedSelfIntersection.modeDrawArea', function() {
|
||||
uiFlash()
|
||||
.text(t('self_intersection.error.areas'))();
|
||||
});
|
||||
|
||||
var addNode = behavior.addNode;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { t } from '../util/locale';
|
||||
import { behaviorDrawWay } from '../behavior/draw_way';
|
||||
import { uiFlash } from '../ui/flash';
|
||||
|
||||
|
||||
export function modeDrawLine(context, wayID, startGraph, baselineGraph, button, affix, continuing) {
|
||||
@@ -20,7 +21,11 @@ export function modeDrawLine(context, wayID, startGraph, baselineGraph, button,
|
||||
var headID = (affix === 'prefix') ? way.first() : way.last();
|
||||
|
||||
behavior = behaviorDrawWay(context, wayID, index, mode, startGraph, baselineGraph)
|
||||
.tail(t('modes.draw_line.tail'));
|
||||
.tail(t('modes.draw_line.tail'))
|
||||
.on('rejectedSelfIntersection.modeDrawLine', function() {
|
||||
uiFlash()
|
||||
.text(t('self_intersection.error.lines'))();
|
||||
});
|
||||
|
||||
var addNode = behavior.addNode;
|
||||
behavior.addNode = function(node, d) {
|
||||
|
||||
Reference in New Issue
Block a user