Remove broken "tail" functionality (close #7560)

This commit is contained in:
Quincy Morgan
2020-05-07 10:26:50 -07:00
parent 8a9f4c3131
commit 7a3a84b7b2
15 changed files with 0 additions and 201 deletions

View File

@@ -5084,53 +5084,6 @@ svg.mouseclick use.right {
background-color: #fff;
}
.tail {
width: 200px;
height: 400px;
pointer-events: none;
opacity: .8;
margin-top: -200px;
position: absolute;
background: transparent;
}
.tail::after {
content: "";
position: absolute;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
top: 50%;
right: -5px;
margin-top: -5px;
border-left-color: #fff;
border-width: 5px 0 5px 5px;
}
.tail div {
border-radius: 3px;
padding: 10px;
background: #fff;
position: absolute;
top: 180px;
left: 0;
right: 0;
margin: auto;
}
.left.tail::after {
content: "";
position: absolute;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
top: 50%;
left: -5px;
margin-top: -5px;
border-right-color: #fff;
border-width: 5px 5px 5px 0;
}
.popover-arrow {
position: absolute;
width: 0;

View File

@@ -33,33 +33,25 @@ en:
add_area:
title: Area
description: "Add parks, buildings, lakes or other areas to the map."
tail: "Click on the map to start drawing an area, like a park, lake, or building."
filter_tooltip: areas
add_line:
title: Line
description: "Add highways, streets, pedestrian paths, canals or other lines to the map."
tail: "Click on the map to start drawing a road, path, or route."
filter_tooltip: lines
add_point:
title: Point
description: "Add restaurants, monuments, postal boxes or other points to the map."
tail: Click on the map to add a point.
filter_tooltip: points
add_note:
title: Note
label: Add Note
description: "Spotted an issue? Let other mappers know."
tail: Click on the map to add a note.
key: N
add_preset:
title: "Add {feature}"
browse:
title: Browse
description: Pan and zoom the map.
draw_area:
tail: Click to add nodes to your area. Click the first node to finish the area.
draw_line:
tail: "Click to add more nodes to the line. Click on other lines to connect to them, and double-click to end the line."
drag_node:
connected_to_hidden: This can't be edited because it is connected to a hidden feature.
operations:

10
dist/locales/en.json vendored
View File

@@ -39,26 +39,22 @@
"add_area": {
"title": "Area",
"description": "Add parks, buildings, lakes or other areas to the map.",
"tail": "Click on the map to start drawing an area, like a park, lake, or building.",
"filter_tooltip": "areas"
},
"add_line": {
"title": "Line",
"description": "Add highways, streets, pedestrian paths, canals or other lines to the map.",
"tail": "Click on the map to start drawing a road, path, or route.",
"filter_tooltip": "lines"
},
"add_point": {
"title": "Point",
"description": "Add restaurants, monuments, postal boxes or other points to the map.",
"tail": "Click on the map to add a point.",
"filter_tooltip": "points"
},
"add_note": {
"title": "Note",
"label": "Add Note",
"description": "Spotted an issue? Let other mappers know.",
"tail": "Click on the map to add a note.",
"key": "N"
},
"add_preset": {
@@ -68,12 +64,6 @@
"title": "Browse",
"description": "Pan and zoom the map."
},
"draw_area": {
"tail": "Click to add nodes to your area. Click the first node to finish the area."
},
"draw_line": {
"tail": "Click to add more nodes to the line. Click on other lines to connect to them, and double-click to end the line."
},
"drag_node": {
"connected_to_hidden": "This can't be edited because it is connected to a hidden feature."
}

View File

@@ -37,11 +37,5 @@ export function behaviorAddWay(context) {
};
behavior.tail = function(text) {
draw.tail(text);
return behavior;
};
return utilRebind(behavior, dispatch, 'on');
}

View File

@@ -8,11 +8,9 @@ import {
import { presetManager } from '../presets';
import { behaviorEdit } from './edit';
import { behaviorHover } from './hover';
import { behaviorTail } from './tail';
import { geoChooseEdge, geoVecLength } from '../geo';
import { utilFastMouse, utilKeybinding, utilRebind } from '../util';
var _usedTails = {};
var _disableSpace = false;
var _lastSpace = null;
@@ -26,7 +24,6 @@ export function behaviorDraw(context) {
var _hover = behaviorHover(context).altDisables(true).ignoreVertex(true)
.on('hover', context.ui().sidebar.hover);
var tail = behaviorTail();
var edit = behaviorEdit(context);
var closeTolerance = 4;
@@ -201,10 +198,6 @@ export function behaviorDraw(context) {
context.install(_hover);
context.install(edit);
if (!context.inIntro() && !_usedTails[tail.text()]) {
context.install(tail);
}
keybinding
.on('⌫', backspace)
.on('⌦', del)
@@ -231,11 +224,6 @@ export function behaviorDraw(context) {
context.uninstall(_hover);
context.uninstall(edit);
if (!context.inIntro() && !_usedTails[tail.text()]) {
context.uninstall(tail);
_usedTails[tail.text()] = true;
}
selection
.on('mouseenter.draw', null)
.on('mouseleave.draw', null)
@@ -251,11 +239,6 @@ export function behaviorDraw(context) {
};
behavior.tail = function(_) {
tail.text(_);
return behavior;
};
behavior.hover = function() {
return _hover;
};

View File

@@ -428,11 +428,5 @@ export function behaviorDrawWay(context, wayID, index, mode, startGraph) {
};
drawWay.tail = function(text) {
behavior.tail(text);
return drawWay;
};
return utilRebind(drawWay, dispatch, 'on');
}

View File

@@ -11,4 +11,3 @@ export { behaviorLasso } from './lasso';
export { behaviorOperation } from './operation';
export { behaviorPaste } from './paste';
export { behaviorSelect } from './select';
export { behaviorTail } from './tail';

View File

@@ -1,99 +0,0 @@
import {
event as d3_event,
select as d3_select
} from 'd3-selection';
import { utilSetTransform } from '../util';
import { utilGetDimensions } from '../util/dimensions';
export function behaviorTail() {
var container;
var xmargin = 25;
var tooltipSize = [0, 0];
var selectionSize = [0, 0];
var _text;
function behavior(selection) {
if (!_text) return;
d3_select(window)
.on('resize.tail', function() { selectionSize = utilGetDimensions(selection); });
container = d3_select(document.body)
.append('div')
.style('display', 'none')
.attr('class', 'tail popover-inner');
container.append('div')
.text(_text);
selection
.on('mousemove.tail', mousemove)
.on('mouseenter.tail', mouseenter)
.on('mouseleave.tail', mouseleave);
container
.on('mousemove.tail', mousemove);
tooltipSize = utilGetDimensions(container);
selectionSize = utilGetDimensions(selection);
function show() {
container.style('display', 'block');
tooltipSize = utilGetDimensions(container);
}
function mousemove() {
if (container.style('display') === 'none') show();
var xoffset = ((d3_event.clientX + tooltipSize[0] + xmargin) > selectionSize[0]) ?
-tooltipSize[0] - xmargin : xmargin;
container.classed('left', xoffset > 0);
utilSetTransform(container, d3_event.clientX + xoffset, d3_event.clientY);
}
function mouseleave() {
if (d3_event.relatedTarget !== container.node()) {
container.style('display', 'none');
}
}
function mouseenter() {
if (d3_event.relatedTarget !== container.node()) {
show();
}
}
}
behavior.off = function(selection) {
if (!_text) return;
container
.on('mousemove.tail', null)
.remove();
selection
.on('mousemove.tail', null)
.on('mouseenter.tail', null)
.on('mouseleave.tail', null);
d3_select(window)
.on('resize.tail', null);
};
behavior.text = function(val) {
if (!arguments.length) return _text;
_text = val;
return behavior;
};
return behavior;
}

View File

@@ -12,7 +12,6 @@ export function modeAddArea(context, mode) {
mode.id = 'add-area';
var behavior = behaviorAddWay(context)
.tail(t('modes.add_area.tail'))
.on('start', start)
.on('startFromWay', startFromWay)
.on('startFromNode', startFromNode);

View File

@@ -12,7 +12,6 @@ export function modeAddLine(context, mode) {
mode.id = 'add-line';
var behavior = behaviorAddWay(context)
.tail(t('modes.add_line.tail'))
.on('start', start)
.on('startFromWay', startFromWay)
.on('startFromNode', startFromNode);

View File

@@ -16,7 +16,6 @@ export function modeAddNote(context) {
};
var behavior = behaviorDraw(context)
.tail(t('modes.add_note.tail'))
.on('click', add)
.on('cancel', cancel)
.on('finish', cancel);

View File

@@ -13,7 +13,6 @@ export function modeAddPoint(context, mode) {
mode.id = 'add-point';
var behavior = behaviorDraw(context)
.tail(t('modes.add_point.tail'))
.on('click', add)
.on('clickWay', addWay)
.on('clickNode', addNode)

View File

@@ -16,7 +16,6 @@ export function modeDrawArea(context, wayID, startGraph, button) {
var way = context.entity(wayID);
behavior = behaviorDrawWay(context, wayID, undefined, mode, startGraph)
.tail(t('modes.draw_area.tail'))
.on('rejectedSelfIntersection.modeDrawArea', function() {
context.ui().flash
.text(t('self_intersection.error.areas'))();

View File

@@ -20,7 +20,6 @@ export function modeDrawLine(context, wayID, startGraph, button, affix, continui
var headID = (affix === 'prefix') ? way.first() : way.last();
behavior = behaviorDrawWay(context, wayID, index, mode, startGraph)
.tail(t('modes.draw_line.tail'))
.on('rejectedSelfIntersection.modeDrawLine', function() {
context.ui().flash
.text(t('self_intersection.error.lines'))();

View File

@@ -29,7 +29,6 @@ mocha.setup({
timeout: 5000, // 5 sec
ui: 'bdd',
globals: [
'__onresize.tail-size',
'__onmousemove.zoom',
'__onmouseup.zoom',
'__onkeydown.select',