mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-12 16:52:50 +00:00
use lodash-es everywhere, replace custom clamp methods with lodash
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import deepEqual from 'fast-deep-equal';
|
||||
import { diff3Merge } from 'node-diff3';
|
||||
import { escape } from 'lodash';
|
||||
import { escape } from 'lodash-es';
|
||||
|
||||
import { t } from '../core/localizer';
|
||||
import { actionDeleteMultiple } from './delete_multiple';
|
||||
|
||||
@@ -296,7 +296,7 @@ export function isColourValid(value) {
|
||||
}
|
||||
|
||||
// https://wiki.openstreetmap.org/wiki/Special:WhatLinksHere/Property:P44
|
||||
export var osmMutuallyExclusiveTagPairs = [
|
||||
export const osmMutuallyExclusiveTagPairs = [
|
||||
['noname', 'name'],
|
||||
['noref', 'ref'],
|
||||
['nohousenumber', 'addr:housenumber'],
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { isEqual } from 'lodash';
|
||||
import { isEqual } from 'lodash-es';
|
||||
|
||||
import { t } from '../core/localizer';
|
||||
import { osmAreaKeys, osmAreaKeysExceptions } from '../osm/tags';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { geoArea as d3_geoArea, geoMercatorRaw as d3_geoMercatorRaw } from 'd3-geo';
|
||||
import { json as d3_json } from 'd3-fetch';
|
||||
import { escape } from 'lodash';
|
||||
import { escape } from 'lodash-es';
|
||||
|
||||
import { t, localizer } from '../core/localizer';
|
||||
import { geoExtent, geoSphericalDistance } from '../geo';
|
||||
|
||||
@@ -17,7 +17,7 @@ import { utilGetDimensions } from '../util/dimensions';
|
||||
import { utilRebind } from '../util/rebind';
|
||||
import { utilZoomPan } from '../util/zoom_pan';
|
||||
import { utilDoubleUp } from '../util/double_up';
|
||||
import { isArray } from 'lodash-es';
|
||||
import { isArray, clamp } from 'lodash-es';
|
||||
|
||||
// constants
|
||||
var TILESIZE = 256;
|
||||
@@ -26,10 +26,6 @@ var maxZoom = 24;
|
||||
var kMin = geoZoomToScale(minZoom, TILESIZE);
|
||||
var kMax = geoZoomToScale(maxZoom, TILESIZE);
|
||||
|
||||
function clamp(num, min, max) {
|
||||
return Math.max(min, Math.min(num, max));
|
||||
}
|
||||
|
||||
|
||||
export function rendererMap(context) {
|
||||
var dispatch = d3_dispatch(
|
||||
|
||||
@@ -5,7 +5,7 @@ import { zoom as d3_zoom, zoomIdentity as d3_zoomIdentity } from 'd3-zoom';
|
||||
import Protobuf from 'pbf';
|
||||
import RBush from 'rbush';
|
||||
import { VectorTile } from '@mapbox/vector-tile';
|
||||
import { isEqual } from 'lodash';
|
||||
import { isEqual } from 'lodash-es';
|
||||
|
||||
import { utilRebind, utilTiler, utilQsString, utilStringQs, utilSetTransform } from '../util';
|
||||
import {geoExtent, geoScaleToZoom} from '../geo';
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import deepEqual from 'fast-deep-equal';
|
||||
import { clamp } from 'lodash-es';
|
||||
|
||||
import { geoScaleToZoom } from '../geo';
|
||||
import { osmEntity, osmIsInterestingTag } from '../osm';
|
||||
import { svgPointTransform } from './helpers';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
import { clamp } from 'lodash-es';
|
||||
|
||||
import { t } from '../core/localizer';
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
@@ -247,10 +248,6 @@ export function uiPhotoviewer(context) {
|
||||
dispatch.call(eventName, target, subtractPadding(utilGetDimensions(target, true), target));
|
||||
}
|
||||
|
||||
function clamp(num, min, max) {
|
||||
return Math.max(min, Math.min(num, max));
|
||||
}
|
||||
|
||||
function stopResize(d3_event) {
|
||||
if (pointerId !== (d3_event.pointerId || 'mouse')) return;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
import { clamp } from 'lodash-es';
|
||||
|
||||
import { prefs } from '../../core/preferences';
|
||||
import { t, localizer } from '../../core/localizer';
|
||||
@@ -27,10 +28,6 @@ export function uiSectionBackgroundDisplayOptions(context) {
|
||||
sharpness: 1
|
||||
};
|
||||
|
||||
function clamp(x, min, max) {
|
||||
return Math.max(min, Math.min(x, max));
|
||||
}
|
||||
|
||||
function updateValue(d, val) {
|
||||
val = clamp(val, _minVal, _maxVal);
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { range as d3_range } from 'd3-array';
|
||||
import { clamp } from 'lodash-es';
|
||||
|
||||
import { geoExtent, geoScaleToZoom } from '../geo';
|
||||
|
||||
|
||||
@@ -12,11 +14,6 @@ export function utilTiler() {
|
||||
var _skipNullIsland = false;
|
||||
|
||||
|
||||
function clamp(num, min, max) {
|
||||
return Math.max(min, Math.min(num, max));
|
||||
}
|
||||
|
||||
|
||||
function nearNullIsland(tile) {
|
||||
var x = tile[0];
|
||||
var y = tile[1];
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { clamp } from 'lodash-es';
|
||||
|
||||
import { t, localizer } from '../core/localizer';
|
||||
|
||||
var OSM_PRECISION = 7;
|
||||
@@ -102,10 +104,6 @@ function wrap(x, min, max) {
|
||||
return ((x - min) % d + d) % d + min;
|
||||
}
|
||||
|
||||
function clamp(x, min, max) {
|
||||
return Math.max(min, Math.min(x, max));
|
||||
}
|
||||
|
||||
function roundToDecimal (target, decimalPlace) {
|
||||
target = Number(target);
|
||||
decimalPlace = Number(decimalPlace);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { isEqual } from 'lodash';
|
||||
import { isEqual } from 'lodash-es';
|
||||
|
||||
import { actionAddMidpoint } from '../actions/add_midpoint';
|
||||
import { actionChangeTags } from '../actions/change_tags';
|
||||
|
||||
Reference in New Issue
Block a user