mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-24 13:00:26 +01:00
Use dictionary instead of array to prevent split changes
Changesets for a new area can be out of order, this patch fixes an issue where they could show up in the commit confirm as 'point, area, point(s)' instead of 'points, area'. Fixes #1722
This commit is contained in:
committed by
John Firebaugh
parent
77c0b5041e
commit
74744319cc
@@ -3,7 +3,7 @@ iD.ui.Commit = function(context) {
|
||||
presets = context.presets();
|
||||
|
||||
function zipSame(d) {
|
||||
var c = [], n = -1;
|
||||
var c = {}, n = -1;
|
||||
for (var i = 0; i < d.length; i++) {
|
||||
var desc = {
|
||||
name: d[i].tags.name || presets.match(d[i], context.graph()).name(),
|
||||
@@ -11,15 +11,15 @@ iD.ui.Commit = function(context) {
|
||||
count: 1,
|
||||
tagText: iD.util.tagText(d[i])
|
||||
};
|
||||
if (c[n] &&
|
||||
c[n].name == desc.name &&
|
||||
c[n].tagText == desc.tagText) {
|
||||
c[n].count++;
|
||||
|
||||
var fingerprint = desc.name + desc.tagText;
|
||||
if (c[fingerprint]) {
|
||||
c[fingerprint].count++;
|
||||
} else {
|
||||
c[++n] = desc;
|
||||
c[fingerprint] = desc;
|
||||
}
|
||||
}
|
||||
return c;
|
||||
return _.values(c);
|
||||
}
|
||||
|
||||
function commit(selection) {
|
||||
|
||||
Reference in New Issue
Block a user