mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-02 05:01:38 +02:00
@@ -4,7 +4,6 @@ import { osmEntity, osmIsOldMultipolygonOuterMember } from '../osm';
|
||||
import { svgPath, svgSegmentWay } from './helpers';
|
||||
import { svgTagClasses } from './tag_classes';
|
||||
import _isEqual from 'lodash-es/isEqual';
|
||||
import _omit from 'lodash-es/omit';
|
||||
import { svgTagPattern } from './tag_pattern';
|
||||
|
||||
export function svgAreas(projection, context) {
|
||||
@@ -161,16 +160,13 @@ export function svgAreas(projection, context) {
|
||||
}
|
||||
|
||||
|
||||
var graphEditClass = function(d) {
|
||||
if (d.type !== 'way'){
|
||||
var editClass = function(d) {
|
||||
if (d.type !== 'way') {
|
||||
return '';
|
||||
}
|
||||
var graphEdited = d.nodes.some(function(n) {
|
||||
if (!base.entities[n]) {
|
||||
return true;
|
||||
}
|
||||
var result = !_isEqual(_omit(graph.entities[n], ['tags', 'v']), _omit(base.entities[n], ['tags', 'v']));
|
||||
return result;
|
||||
return !base.entities[n] ||
|
||||
graph.entities[n].loc !== base.entities[n].loc;
|
||||
});
|
||||
|
||||
if (graphEdited){
|
||||
@@ -185,7 +181,7 @@ export function svgAreas(projection, context) {
|
||||
.merge(paths)
|
||||
.each(function(entity) {
|
||||
var layer = this.parentNode.__data__;
|
||||
this.setAttribute('class', entity.type + ' area ' + layer + ' ' + graphEditClass(entity) + ' ' + entity.id);
|
||||
this.setAttribute('class', entity.type + ' area ' + layer + ' ' + editClass(entity) + ' ' + entity.id);
|
||||
|
||||
if (layer === 'fill') {
|
||||
this.setAttribute('clip-path', 'url(#' + entity.id + '-clippath)');
|
||||
|
||||
+14
-20
@@ -9,9 +9,6 @@ import { osmEntity, osmOldMultipolygonOuterMember } from '../osm';
|
||||
import { utilArrayFlatten, utilArrayGroupBy } from '../util';
|
||||
import { utilDetect } from '../util/detect';
|
||||
import _isEqual from 'lodash-es/isEqual';
|
||||
import _transform from 'lodash-es/transform';
|
||||
import _omit from 'lodash-es/omit';
|
||||
import _isObject from 'lodash-es/isObject';
|
||||
|
||||
export function svgLines(projection, context) {
|
||||
var detected = utilDetect();
|
||||
@@ -61,11 +58,8 @@ export function svgLines(projection, context) {
|
||||
|
||||
var graphEditClass = function(d) {
|
||||
return d.properties.nodes.some(function(n) {
|
||||
if (!base.entities[n.id]) {
|
||||
return true;
|
||||
}
|
||||
var result = !_isEqual(_omit(graph.entities[n.id], ['tags', 'v']), _omit(base.entities[n.id], ['tags', 'v']));
|
||||
return result;
|
||||
return !base.entities[n.id] ||
|
||||
graph.entities[n.id].loc !== base.entities[n.id].loc;
|
||||
}) ? ' graphedited ': '';
|
||||
};
|
||||
|
||||
@@ -93,8 +87,8 @@ export function svgLines(projection, context) {
|
||||
.append('path')
|
||||
.merge(nopes)
|
||||
.attr('d', getPath)
|
||||
.attr('class', function(d) {
|
||||
return 'way line target target-nope ' + nopeClass + d.id + graphEditClass(d);
|
||||
.attr('class', function(d) {
|
||||
return 'way line target target-nope ' + nopeClass + d.id + graphEditClass(d);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -115,22 +109,22 @@ export function svgLines(projection, context) {
|
||||
|
||||
// Class for styling currently tag-edited lines, not changes to geometry
|
||||
var tagEditClass = function(d) {
|
||||
var result = graph.entities[d.id] && base.entities[d.id] && !_isEqual(graph.entities[d.id].tags, base.entities[d.id].tags);
|
||||
|
||||
return result ?
|
||||
' tagedited ' : '';
|
||||
if (graph.entities[d.id] && base.entities[d.id] &&
|
||||
!_isEqual(graph.entities[d.id].tags, base.entities[d.id].tags)) {
|
||||
return ' tagedited ';
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
|
||||
// Class for styling currently geometry-edited lines
|
||||
var graphEditClass = function(d) {
|
||||
if (!base.entities[d.id]) {
|
||||
return ' graphedited ';
|
||||
if (!base.entities[d.id] ||
|
||||
(graph.entities[d.id] && base.entities[d.id] &&
|
||||
graph.entities[d.id].nodes !== base.entities[d.id].nodes)) {
|
||||
return ' graphedited ';
|
||||
}
|
||||
|
||||
var result = graph.entities[d.id] && base.entities[d.id] && !_isEqual(_omit(graph.entities[d.id], ['tags', 'v']), _omit(base.entities[d.id], ['tags', 'v']));
|
||||
|
||||
return result ? ' graphedited ' : '';
|
||||
return '';
|
||||
};
|
||||
|
||||
|
||||
|
||||
+8
-11
@@ -4,7 +4,6 @@ import { geoScaleToZoom } from '../geo';
|
||||
import { osmEntity } from '../osm';
|
||||
import { svgPassiveVertex, svgPointTransform } from './helpers';
|
||||
import _isEqual from 'lodash-es/isEqual';
|
||||
import _omit from 'lodash-es/omit';
|
||||
|
||||
export function svgVertices(projection, context) {
|
||||
var radiuses = {
|
||||
@@ -196,8 +195,6 @@ export function svgVertices(projection, context) {
|
||||
var activeID = context.activeID();
|
||||
var data = { targets: [], nopes: [] };
|
||||
var base = context.history().base();
|
||||
var radius = 3;
|
||||
var interestingNodeRadius = 4.5;
|
||||
|
||||
entities.forEach(function(node) {
|
||||
if (activeID === node.id) return; // draw no target on the activeID
|
||||
@@ -229,11 +226,11 @@ export function svgVertices(projection, context) {
|
||||
|
||||
// Class for styling currently edited vertices
|
||||
var editClass = function(d) {
|
||||
//If it doesn't exist in the base graph, it's new geometry.
|
||||
if (!base.entities[d.id] || !_isEqual(_omit(graph.entities[d.id], ['tags', 'v']), _omit(base.entities[d.id], ['tags', 'v']))) {
|
||||
return ' graphedited ';
|
||||
if (!base.entities[d.id] || // if it doesn't exist in the base graph, it's new geometry
|
||||
graph.entities[d.id].loc !== base.entities[d.id].loc) {
|
||||
return 'graphedited';
|
||||
} else if (!_isEqual(graph.entities[d.id].tags, base.entities[d.id].tags)) {
|
||||
return ' tagedited ';
|
||||
return 'tagedited';
|
||||
}
|
||||
return '';
|
||||
};
|
||||
@@ -248,20 +245,20 @@ export function svgVertices(projection, context) {
|
||||
.remove();
|
||||
|
||||
var threeFourths = function (num) {
|
||||
return (Math.round(3 * num) / 4).toFixed(2);
|
||||
};
|
||||
return (Math.round(3 * num) / 4).toFixed(2);
|
||||
};
|
||||
// enter/update
|
||||
targets.enter()
|
||||
.append('circle')
|
||||
.attr('r', function(d) {
|
||||
return isEditedEnt(d, base, graph) && threeFourths(_radii[d.id])
|
||||
|| _radii[d.id]
|
||||
|| _radii[d.id]
|
||||
|| radiuses.shadow[3];
|
||||
})
|
||||
.merge(targets)
|
||||
.attr('class', function(d) {
|
||||
return 'node vertex target target-allowed '
|
||||
+ targetClass + d.id + editClass(d);
|
||||
+ targetClass + d.id + ' ' + editClass(d);
|
||||
})
|
||||
.attr('transform', getTransform);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user