mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-04 05:58:09 +02:00
code quality improvements (unused vars, duplicate css selectors, etc.) (#8965)
* mark function parameter as currently unused * refactor some unused function parameters * consolidate some css selectors
This commit is contained in:
@@ -335,7 +335,7 @@ export function behaviorSelect(context) {
|
||||
.selectedNoteID(datum.id)
|
||||
.enter(modeSelectNote(context, datum.id));
|
||||
|
||||
} else if (datum instanceof QAItem & !isMultiselect) {
|
||||
} else if (datum instanceof QAItem && !isMultiselect) {
|
||||
// targeting an external QA issue
|
||||
context
|
||||
.selectedErrorID(datum.id)
|
||||
|
||||
@@ -14,7 +14,7 @@ import { t } from '../../core/localizer';
|
||||
import { svgIcon } from '../../svg';
|
||||
import { uiTooltip } from '../tooltip';
|
||||
|
||||
export function uiToolOldDrawModes(context) {
|
||||
export function uiToolDrawModes(context) {
|
||||
|
||||
var tool = {
|
||||
id: 'old_modes',
|
||||
@@ -46,7 +46,9 @@ export function uiToolOldDrawModes(context) {
|
||||
];
|
||||
|
||||
|
||||
function enabled() {
|
||||
function enabled(
|
||||
_mode // parameter is currently not used, but might be at some point
|
||||
) {
|
||||
return osmEditable();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ export function uiToolNotes(context) {
|
||||
}
|
||||
|
||||
context.keybinding().on(mode.key, function() {
|
||||
if (!enabled(mode)) return;
|
||||
if (!enabled()) return;
|
||||
|
||||
if (mode.id === context.mode().id) {
|
||||
context.enter(modeBrowse(context));
|
||||
@@ -74,7 +74,7 @@ export function uiToolNotes(context) {
|
||||
.append('button')
|
||||
.attr('class', function(d) { return d.id + ' add-button bar-button'; })
|
||||
.on('click.notes', function(d3_event, d) {
|
||||
if (!enabled(d)) return;
|
||||
if (!enabled()) return;
|
||||
|
||||
// When drawing, ignore accidental clicks on mode buttons - #4042
|
||||
var currMode = context.mode().id;
|
||||
@@ -107,8 +107,8 @@ export function uiToolNotes(context) {
|
||||
// update
|
||||
buttons = buttons
|
||||
.merge(buttonsEnter)
|
||||
.classed('disabled', function(d) { return !enabled(d); })
|
||||
.attr('aria-disabled', function(d) { return !enabled(d); })
|
||||
.classed('disabled', function() { return !enabled(); })
|
||||
.attr('aria-disabled', function() { return !enabled(); })
|
||||
.classed('active', function(d) { return context.mode() && context.mode().button === d.button; })
|
||||
.attr('aria-pressed', function(d) { return context.mode() && context.mode().button === d.button; });
|
||||
}
|
||||
|
||||
@@ -36,15 +36,15 @@ export function uiToolSave(context) {
|
||||
}
|
||||
}
|
||||
|
||||
function bgColor() {
|
||||
function bgColor(numChanges) {
|
||||
var step;
|
||||
if (_numChanges === 0) {
|
||||
if (numChanges === 0) {
|
||||
return null;
|
||||
} else if (_numChanges <= 50) {
|
||||
step = _numChanges / 50;
|
||||
} else if (numChanges <= 50) {
|
||||
step = numChanges / 50;
|
||||
return d3_interpolateRgb('#fff', '#ff8')(step); // white -> yellow
|
||||
} else {
|
||||
step = Math.min((_numChanges - 50) / 50, 1.0);
|
||||
step = Math.min((numChanges - 50) / 50, 1.0);
|
||||
return d3_interpolateRgb('#ff8', '#f88')(step); // yellow -> red
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ import {
|
||||
} from 'd3-selection';
|
||||
|
||||
import _debounce from 'lodash-es/debounce';
|
||||
import { uiToolOldDrawModes, uiToolNotes, uiToolSave, uiToolSidebarToggle, uiToolUndoRedo } from './tools';
|
||||
import { uiToolDrawModes, uiToolNotes, uiToolSave, uiToolSidebarToggle, uiToolUndoRedo } from './tools';
|
||||
|
||||
|
||||
export function uiTopToolbar(context) {
|
||||
|
||||
var sidebarToggle = uiToolSidebarToggle(context),
|
||||
modes = uiToolOldDrawModes(context),
|
||||
modes = uiToolDrawModes(context),
|
||||
notes = uiToolNotes(context),
|
||||
undoRedo = uiToolUndoRedo(context),
|
||||
save = uiToolSave(context);
|
||||
|
||||
Reference in New Issue
Block a user