Merge remote-tracking branch 'origin/master' into brand-name-protection

This commit is contained in:
Bryan Housel
2018-11-26 15:27:56 -05:00
31 changed files with 546 additions and 171 deletions
+21 -10
View File
@@ -452,16 +452,6 @@ export function rendererMap(context) {
x2 = p0[0] - p1[0] * k2;
y2 = p0[1] - p1[1] * k2;
// 2 finger map panning (all browsers) - #5492
// Panning via the `wheel` event will always have:
// - `ctrlKey = false`
// - `deltaX`,`deltaY` are round integer pixels
} else if (!source.ctrlKey && isInteger(dX) && isInteger(dY)) {
p1 = projection.translate();
x2 = p1[0] - dX;
y2 = p1[1] - dY;
k2 = projection.scale();
// 2 finger map pinch zooming (all browsers except Safari) - #5492
// Pinch zooming via the `wheel` event will always have:
// - `ctrlKey = true`
@@ -476,6 +466,27 @@ export function rendererMap(context) {
k2 = t0.k * Math.pow(2, -dY / 500);
x2 = p0[0] - p1[0] * k2;
y2 = p0[1] - p1[1] * k2;
// Trackpad scroll zooming with shift or alt/option key down
} else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
// recalculate x2,y2,k2
t0 = _transformed ? _transformLast : _transformStart;
p0 = mouse(source);
p1 = t0.invert(p0);
k2 = t0.k * Math.pow(2, -dY / 500);
x2 = p0[0] - p1[0] * k2;
y2 = p0[1] - p1[1] * k2;
// 2 finger map panning (all browsers) - #5492
// Panning via the `wheel` event will always have:
// - `ctrlKey = false`
// - `deltaX`,`deltaY` are round integer pixels
} else if (!source.ctrlKey && isInteger(dX) && isInteger(dY)) {
p1 = projection.translate();
x2 = p1[0] - dX;
y2 = p1[1] - dY;
k2 = projection.scale();
}
// something changed - replace the event transform
+6 -5
View File
@@ -6,6 +6,7 @@ import _omit from 'lodash-es/omit';
import { json as d3_json } from 'd3-request';
import { utilQsString } from '../util';
import { currentLocale } from '../util/locale';
var apibase = 'https://taginfo.openstreetmap.org/api/4/',
@@ -189,7 +190,7 @@ export default {
// Fetch popular keys. We'll exclude these from `values`
// lookups because they stress taginfo, and they aren't likely
// to yield meaningful autocomplete results.. see #3955
var params = { rp: 100, sortname: 'values_all', sortorder: 'desc', page: 1, debounce: false };
var params = { rp: 100, sortname: 'values_all', sortorder: 'desc', page: 1, debounce: false, lang: currentLocale };
this.keys(params, function(err, data) {
if (err) return;
data.forEach(function(d) {
@@ -209,7 +210,7 @@ export default {
keys: function(params, callback) {
var doRequest = params.debounce ? debouncedRequest : request;
params = clean(setSort(params));
params = _extend({ rp: 10, sortname: 'count_all', sortorder: 'desc', page: 1 }, params);
params = _extend({ rp: 10, sortname: 'count_all', sortorder: 'desc', page: 1, lang: currentLocale }, params);
var url = apibase + 'keys/all?' + utilQsString(params);
doRequest(url, params, false, callback, function(err, d) {
@@ -228,7 +229,7 @@ export default {
multikeys: function(params, callback) {
var doRequest = params.debounce ? debouncedRequest : request;
params = clean(setSort(params));
params = _extend({ rp: 25, sortname: 'count_all', sortorder: 'desc', page: 1 }, params);
params = _extend({ rp: 25, sortname: 'count_all', sortorder: 'desc', page: 1, lang: currentLocale }, params);
var prefix = params.query;
var url = apibase + 'keys/all?' + utilQsString(params);
@@ -255,7 +256,7 @@ export default {
var doRequest = params.debounce ? debouncedRequest : request;
params = clean(setSort(setFilter(params)));
params = _extend({ rp: 25, sortname: 'count_all', sortorder: 'desc', page: 1 }, params);
params = _extend({ rp: 25, sortname: 'count_all', sortorder: 'desc', page: 1, lang: currentLocale }, params);
var url = apibase + 'key/values?' + utilQsString(params);
doRequest(url, params, false, callback, function(err, d) {
@@ -282,7 +283,7 @@ export default {
var doRequest = params.debounce ? debouncedRequest : request;
var geometry = params.geometry;
params = clean(setSortMembers(params));
params = _extend({ rp: 25, sortname: 'count_all_members', sortorder: 'desc', page: 1 }, params);
params = _extend({ rp: 25, sortname: 'count_all_members', sortorder: 'desc', page: 1, lang: currentLocale }, params);
var url = apibase + 'relation/roles?' + utilQsString(params);
doRequest(url, params, true, callback, function(err, d) {
+5 -2
View File
@@ -107,7 +107,11 @@ export function uiField(context, presetField, entity, options) {
var label = enter
.append('label')
.attr('class', 'form-label')
.attr('for', function(d) { return 'preset-input-' + d.safeid; })
.attr('for', function(d) { return 'preset-input-' + d.safeid; });
label
.append('span')
.attr('class', 'label-text')
.text(function(d) { return d.label(); });
var wrap = label
@@ -228,4 +232,3 @@ export function uiField(context, presetField, entity, options) {
return utilRebind(field, dispatch, 'on');
}
+4 -4
View File
@@ -21,7 +21,7 @@ export function uiFieldAccess(field, context) {
wrap = wrap.enter()
.append('div')
.attr('class', 'cf preset-input-wrap')
.attr('class', 'preset-input-wrap')
.append('ul')
.merge(wrap);
@@ -39,17 +39,17 @@ export function uiFieldAccess(field, context) {
// Enter
var enter = items.enter()
.append('li')
.attr('class', function(d) { return 'cf preset-access-' + d; });
.attr('class', function(d) { return 'preset-access-' + d; });
enter
.append('span')
.attr('class', 'col6 label preset-label-access')
.attr('class', 'label preset-label-access')
.attr('for', function(d) { return 'preset-input-access-' + d; })
.text(function(d) { return field.t('types.' + d); });
enter
.append('div')
.attr('class', 'col6 preset-input-access-wrap')
.attr('class', 'preset-input-access-wrap')
.append('input')
.attr('type', 'text')
.attr('class', 'preset-input-access')
+4 -4
View File
@@ -28,7 +28,7 @@ export function uiFieldCycleway(field, context) {
wrap = wrap.enter()
.append('div')
.attr('class', 'cf preset-input-wrap')
.attr('class', 'preset-input-wrap')
.merge(wrap);
@@ -45,17 +45,17 @@ export function uiFieldCycleway(field, context) {
var enter = items.enter()
.append('li')
.attr('class', function(d) { return 'cf preset-cycleway-' + stripcolon(d); });
.attr('class', function(d) { return 'preset-cycleway-' + stripcolon(d); });
enter
.append('span')
.attr('class', 'col6 label preset-label-cycleway')
.attr('class', 'label preset-label-cycleway')
.attr('for', function(d) { return 'preset-input-cycleway-' + stripcolon(d); })
.text(function(d) { return field.t('types.' + d); });
enter
.append('div')
.attr('class', 'col6 preset-input-cycleway-wrap')
.attr('class', 'preset-input-cycleway-wrap')
.append('input')
.attr('type', 'text')
.attr('class', function(d) { return 'preset-input-cycleway preset-input-' + stripcolon(d); })
+5 -2
View File
@@ -50,6 +50,7 @@ export function uiFieldText(field, context) {
.attr('type', field.type)
.attr('id', fieldID)
.attr('placeholder', field.placeholder() || t('inspector.unknown'))
.classed(field.type, true)
.call(utilNoAuto)
.merge(input);
@@ -87,13 +88,15 @@ export function uiFieldText(field, context) {
enter
.append('button')
.datum(rtl ? 1 : -1)
.attr('class', rtl ? 'increment' : 'decrement')
.attr('class', 'button-input-action minor')
.classed(rtl ? 'increment' : 'decrement', true)
.attr('tabindex', -1);
enter
.append('button')
.datum(rtl ? -1 : 1)
.attr('class', rtl ? 'decrement' : 'increment')
.attr('class', 'button-input-action minor')
.classed(rtl ? 'decrement' : 'increment', true)
.attr('tabindex', -1);
spinControl = spinControl
+10 -6
View File
@@ -310,20 +310,24 @@ export function uiFieldLocalized(field, context) {
var label = wrap
.append('label')
.attr('class', 'form-label')
.text(t('translate.localized_translation_label'))
.attr('for', 'localized-lang');
label
.append('span')
.attr('class', 'label-text')
.text(t('translate.localized_translation_label'));
label
.append('div')
.attr('class', 'form-label-button-wrap')
.append('button')
.attr('class', 'minor remove')
.on('click', function(d) {
.attr('class', 'minor remove-icon')
.on('click', function(d){
if (_isLocked) return;
d3_event.preventDefault();
var t = {};
t[key(d.lang)] = undefined;
dispatch.call('change', this, t);
d3_select(this.parentNode.parentNode)
d3_select(this.parentNode.parentNode.parentNode)
.style('top', '0')
.style('max-height', '240px')
.transition()
+6 -6
View File
@@ -125,17 +125,17 @@ export function uiFieldRadio(field, context) {
// Enter
var typeEnter = typeItem.enter()
.insert('li', ':first-child')
.attr('class', 'cf structure-type-item');
.attr('class', 'structure-type-item');
typeEnter
.append('span')
.attr('class', 'col6 label structure-label-type')
.attr('class', 'label structure-label-type')
.attr('for', 'preset-input-' + selected)
.text(t('inspector.radio.structure.type'));
typeEnter
.append('div')
.attr('class', 'col6 structure-input-type-wrap');
.attr('class', 'structure-input-type-wrap');
// Update
typeItem = typeItem
@@ -170,17 +170,17 @@ export function uiFieldRadio(field, context) {
// Enter
var layerEnter = layerItem.enter()
.append('li')
.attr('class', 'cf structure-layer-item');
.attr('class', 'structure-layer-item');
layerEnter
.append('span')
.attr('class', 'col6 label structure-label-layer')
.attr('class', 'label structure-label-layer')
.attr('for', 'preset-input-layer')
.text(t('inspector.radio.structure.layer'));
layerEnter
.append('div')
.attr('class', 'col6 structure-input-layer-wrap');
.attr('class', 'structure-input-layer-wrap');
// Update
layerItem = layerItem
+13 -3
View File
@@ -45,6 +45,9 @@ export function uiRawMemberEditor(context) {
function selectMember(d) {
d3_event.preventDefault();
// remove the hover-highlight styling
utilHighlightEntity(d.id, false, context);
var entity = context.entity(d.id);
var mapExtent = context.map().extent();
if (!entity.intersects(mapExtent, context.graph())) {
@@ -145,7 +148,10 @@ export function uiRawMemberEditor(context) {
var label = d3_select(this).append('label')
.attr('class', 'form-label');
var labelLink = label.append('a')
var labelLink = label
.append('span')
.attr('class', 'label-text')
.append('a')
.attr('href', '#')
.on('click', selectMember);
@@ -174,11 +180,15 @@ export function uiRawMemberEditor(context) {
var incompleteLabel = d3_select(this).append('label')
.attr('class', 'form-label');
incompleteLabel.append('span')
var labelText = incompleteLabel
.append('span')
.attr('class', 'label-text');
labelText.append('span')
.attr('class', 'member-entity-type')
.text(t('inspector.'+d.type, { id: d.id }));
incompleteLabel.append('span')
labelText.append('span')
.attr('class', 'member-entity-name')
.text(t('inspector.incomplete', { id: d.id }));
+6
View File
@@ -35,6 +35,10 @@ export function uiRawMembershipEditor(context) {
function selectRelation(d) {
d3_event.preventDefault();
// remove the hover-highlight styling
utilHighlightEntity(d.relation.id, false, context);
context.enter(modeSelect(context, [d.relation.id]));
}
@@ -186,6 +190,8 @@ export function uiRawMembershipEditor(context) {
var label = enter
.append('label')
.attr('class', 'form-label')
.append('span')
.attr('class', 'label-text')
.append('a')
.attr('href', '#')
.on('click', selectRelation);
+1 -1
View File
@@ -103,7 +103,7 @@ export function uiRawTagEditor(context) {
var enter = items.enter()
.append('li')
.attr('class', 'tag-row cf')
.attr('class', 'tag-row')
.classed('readonly', isReadOnly);
var innerWrap = enter.append('div')
+1 -1
View File
@@ -187,7 +187,7 @@ export function uiTagReference(tag) {
_body = _body.enter()
.append('div')
.attr('class', 'tag-reference-body cf')
.attr('class', 'tag-reference-body')
.style('max-height', '0')
.style('opacity', '0')
.merge(_body);