mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-19 15:08:23 +02:00
Replace usage of lodash isEqual (re: #6843)
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import deepEqual from 'fast-deep-equal';
|
||||
import { bisector as d3_bisector } from 'd3-array';
|
||||
|
||||
import { osmEntity, osmIsOldMultipolygonOuterMember } from '../osm';
|
||||
import { svgPath, svgSegmentWay } from './helpers';
|
||||
import { svgTagClasses } from './tag_classes';
|
||||
import _isEqual from 'lodash-es/isEqual';
|
||||
import { svgTagPattern } from './tag_pattern';
|
||||
|
||||
export function svgAreas(projection, context) {
|
||||
@@ -49,7 +49,7 @@ export function svgAreas(projection, context) {
|
||||
var wayID = d.properties.entity.id;
|
||||
// if the whole line was edited, don't draw segment changes
|
||||
if (!base.entities[wayID] ||
|
||||
!_isEqual(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
|
||||
!deepEqual(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
|
||||
return '';
|
||||
}
|
||||
return d.properties.nodes.some(function(n) {
|
||||
@@ -191,12 +191,12 @@ export function svgAreas(projection, context) {
|
||||
.classed('geometry-edited', function(d) {
|
||||
return graph.entities[d.id] &&
|
||||
base.entities[d.id] &&
|
||||
!_isEqual(graph.entities[d.id].nodes, base.entities[d.id].nodes);
|
||||
!deepEqual(graph.entities[d.id].nodes, base.entities[d.id].nodes);
|
||||
})
|
||||
.classed('retagged', function(d) {
|
||||
return graph.entities[d.id] &&
|
||||
base.entities[d.id] &&
|
||||
!_isEqual(graph.entities[d.id].tags, base.entities[d.id].tags);
|
||||
!deepEqual(graph.entities[d.id].tags, base.entities[d.id].tags);
|
||||
})
|
||||
.call(svgTagClasses())
|
||||
.attr('d', path);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import deepEqual from 'fast-deep-equal';
|
||||
import { range as d3_range } from 'd3-array';
|
||||
|
||||
import {
|
||||
@@ -8,7 +9,6 @@ import { svgTagClasses } from './tag_classes';
|
||||
import { osmEntity, osmOldMultipolygonOuterMember } from '../osm';
|
||||
import { utilArrayFlatten, utilArrayGroupBy } from '../util';
|
||||
import { utilDetect } from '../util/detect';
|
||||
import _isEqual from 'lodash-es/isEqual';
|
||||
|
||||
export function svgLines(projection, context) {
|
||||
var detected = utilDetect();
|
||||
@@ -60,7 +60,7 @@ export function svgLines(projection, context) {
|
||||
var wayID = d.properties.entity.id;
|
||||
// if the whole line was edited, don't draw segment changes
|
||||
if (!base.entities[wayID] ||
|
||||
!_isEqual(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
|
||||
!deepEqual(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
|
||||
return '';
|
||||
}
|
||||
return d.properties.nodes.some(function(n) {
|
||||
@@ -148,12 +148,12 @@ export function svgLines(projection, context) {
|
||||
.classed('geometry-edited', function(d) {
|
||||
return graph.entities[d.id] &&
|
||||
base.entities[d.id] &&
|
||||
!_isEqual(graph.entities[d.id].nodes, base.entities[d.id].nodes);
|
||||
!deepEqual(graph.entities[d.id].nodes, base.entities[d.id].nodes);
|
||||
})
|
||||
.classed('retagged', function(d) {
|
||||
return graph.entities[d.id] &&
|
||||
base.entities[d.id] &&
|
||||
!_isEqual(graph.entities[d.id].tags, base.entities[d.id].tags);
|
||||
!deepEqual(graph.entities[d.id].tags, base.entities[d.id].tags);
|
||||
})
|
||||
.call(svgTagClasses())
|
||||
.merge(lines)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import deepEqual from 'fast-deep-equal';
|
||||
import { geoScaleToZoom } from '../geo';
|
||||
import { osmEntity } from '../osm';
|
||||
import { svgPointTransform } from './helpers';
|
||||
import { svgTagClasses } from './tag_classes';
|
||||
import _isEqual from 'lodash-es/isEqual';
|
||||
|
||||
export function svgPoints(projection, context) {
|
||||
|
||||
@@ -130,10 +130,10 @@ export function svgPoints(projection, context) {
|
||||
return !base.entities[d.id]; // if it doesn't exist in the base graph, it's new
|
||||
})
|
||||
.classed('moved', function(d) {
|
||||
return base.entities[d.id] && !_isEqual(graph.entities[d.id].loc, base.entities[d.id].loc);
|
||||
return base.entities[d.id] && !deepEqual(graph.entities[d.id].loc, base.entities[d.id].loc);
|
||||
})
|
||||
.classed('retagged', function(d) {
|
||||
return base.entities[d.id] && !_isEqual(graph.entities[d.id].tags, base.entities[d.id].tags);
|
||||
return base.entities[d.id] && !deepEqual(graph.entities[d.id].tags, base.entities[d.id].tags);
|
||||
})
|
||||
.call(svgTagClasses());
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import deepEqual from 'fast-deep-equal';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { geoScaleToZoom } from '../geo';
|
||||
import { osmEntity } from '../osm';
|
||||
import { svgPassiveVertex, svgPointTransform } from './helpers';
|
||||
import _isEqual from 'lodash-es/isEqual';
|
||||
|
||||
export function svgVertices(projection, context) {
|
||||
var radiuses = {
|
||||
@@ -134,10 +134,10 @@ export function svgVertices(projection, context) {
|
||||
return !base.entities[d.id]; // if it doesn't exist in the base graph, it's new
|
||||
})
|
||||
.classed('moved', function(d) {
|
||||
return base.entities[d.id] && !_isEqual(graph.entities[d.id].loc, base.entities[d.id].loc);
|
||||
return base.entities[d.id] && !deepEqual(graph.entities[d.id].loc, base.entities[d.id].loc);
|
||||
})
|
||||
.classed('retagged', function(d) {
|
||||
return base.entities[d.id] && !_isEqual(graph.entities[d.id].tags, base.entities[d.id].tags);
|
||||
return base.entities[d.id] && !deepEqual(graph.entities[d.id].tags, base.entities[d.id].tags);
|
||||
})
|
||||
.call(updateAttributes);
|
||||
|
||||
@@ -293,7 +293,7 @@ export function svgVertices(projection, context) {
|
||||
|
||||
function isEditedEntity(entity, base, head) {
|
||||
return head.entities[entity.id] !== base.entities[entity.id] ||
|
||||
!_isEqual(head.entities[entity.id].tags, base.entities[entity.id].tags);
|
||||
!deepEqual(head.entities[entity.id].tags, base.entities[entity.id].tags);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user