mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-06 19:31:41 +00:00
Merge branch 'new_branch_name'
This commit is contained in:
@@ -11,6 +11,7 @@ iD.actions.Orthogonalize = function(wayId, projection) {
|
||||
|
||||
if (nodes.length === 4) {
|
||||
points = _.uniq(nodes).map(function(n) { return projection(n.loc); });
|
||||
|
||||
for (i = 0; i < 1000; i++) {
|
||||
motions = points.map(calcMotion);
|
||||
points[corner.i] = addPoints(points[corner.i],motions[corner.i]);
|
||||
@@ -19,12 +20,14 @@ iD.actions.Orthogonalize = function(wayId, projection) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
graph = graph.replace(graph.entity(nodes[corner.i].id)
|
||||
.move(projection.invert(points[corner.i])));
|
||||
} else {
|
||||
var best;
|
||||
points = nodes.map(function(n) { return projection(n.loc); });
|
||||
score = squareness();
|
||||
|
||||
for (i = 0; i < 1000; i++) {
|
||||
motions = points.map(calcMotion);
|
||||
for (j = 0; j < motions.length; j++) {
|
||||
@@ -39,12 +42,15 @@ iD.actions.Orthogonalize = function(wayId, projection) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
points = best;
|
||||
|
||||
for (i = 0; i < points.length - 1; i++) {
|
||||
graph = graph.replace(graph.entity(nodes[i].id)
|
||||
.move(projection.invert(points[i])));
|
||||
}
|
||||
}
|
||||
|
||||
return graph;
|
||||
|
||||
function calcMotion(b, i, array) {
|
||||
@@ -64,11 +70,9 @@ iD.actions.Orthogonalize = function(wayId, projection) {
|
||||
if (dotp < -0.707106781186547) {
|
||||
dotp += 1.0;
|
||||
}
|
||||
} else {
|
||||
if( Math.abs(dotp) < corner.dotp){
|
||||
corner.i = i;
|
||||
corner.dotp = Math.abs(dotp);
|
||||
}
|
||||
} else if (Math.abs(dotp) < corner.dotp) {
|
||||
corner.i = i;
|
||||
corner.dotp = Math.abs(dotp);
|
||||
}
|
||||
|
||||
return normalizePoint(addPoints(p, q), 0.1 * dotp * scale);
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
iD.ui.PresetGrid = function(context, entity) {
|
||||
var event = d3.dispatch('choose', 'close'),
|
||||
default_limit = 9,
|
||||
currently_drawn = 9,
|
||||
presets,
|
||||
taginfo = iD.taginfo();
|
||||
defaultLimit = 9,
|
||||
currentlyDrawn = 9,
|
||||
presets;
|
||||
|
||||
function presetgrid(selection, preset) {
|
||||
|
||||
@@ -39,14 +38,14 @@ iD.ui.PresetGrid = function(context, entity) {
|
||||
.attr('class', 'preset-grid fillL cf')
|
||||
.data([context.presets().defaults(entity, 36).collection]);
|
||||
|
||||
var show_more = gridwrap.append('button')
|
||||
var showMore = gridwrap.append('button')
|
||||
.attr('class', 'fillL show-more')
|
||||
.text(t('inspector.show_more'))
|
||||
.on('click', function() {
|
||||
grid.call(drawGrid, (currently_drawn += default_limit));
|
||||
grid.call(drawGrid, (currentlyDrawn += defaultLimit));
|
||||
});
|
||||
|
||||
grid.call(drawGrid, default_limit);
|
||||
grid.call(drawGrid, defaultLimit);
|
||||
|
||||
var searchwrap = selection.append('div')
|
||||
.attr('class', 'preset-grid-search-wrap inspector-inner');
|
||||
@@ -76,7 +75,7 @@ iD.ui.PresetGrid = function(context, entity) {
|
||||
if (d3.event.keyCode === 13 && value.length) {
|
||||
choose(grid.selectAll('.grid-entry:first-child').datum());
|
||||
} else {
|
||||
currently_drawn = default_limit;
|
||||
currentlyDrawn = defaultLimit;
|
||||
grid.classed('filtered', value.length);
|
||||
if (value.length) {
|
||||
var results = presets.search(value);
|
||||
@@ -85,10 +84,10 @@ iD.ui.PresetGrid = function(context, entity) {
|
||||
search: value
|
||||
}));
|
||||
grid.data([results.collection])
|
||||
.call(drawGrid, default_limit);
|
||||
.call(drawGrid, defaultLimit);
|
||||
} else {
|
||||
grid.data([context.presets().defaults(entity, 36).collection])
|
||||
.call(drawGrid, default_limit);
|
||||
.call(drawGrid, defaultLimit);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,7 +221,7 @@ iD.ui.PresetGrid = function(context, entity) {
|
||||
}
|
||||
|
||||
if (selection.node() === grid.node()) {
|
||||
show_more
|
||||
showMore
|
||||
.style('display', (selection.data()[0].length > limit) ? 'block' : 'none');
|
||||
}
|
||||
|
||||
@@ -232,20 +231,21 @@ iD.ui.PresetGrid = function(context, entity) {
|
||||
.selectAll('div.grid-entry-wrap')
|
||||
.data(function(d) { return d.slice(0, limit); }, name);
|
||||
|
||||
entries.exit().remove();
|
||||
entries.exit()
|
||||
.remove();
|
||||
|
||||
var entered = entries.enter()
|
||||
.append('div')
|
||||
.attr('class','grid-button-wrap col4 grid-entry-wrap')
|
||||
.classed('category', function(d) { return !!d.members; })
|
||||
.classed('current', function(d) { return d === preset; })
|
||||
.append('button')
|
||||
.attr('class', 'grid-entry')
|
||||
.on('click', choose);
|
||||
.append('button')
|
||||
.attr('class', 'grid-entry')
|
||||
.on('click', choose);
|
||||
|
||||
entered.style('opacity', 0)
|
||||
.transition()
|
||||
.style('opacity', 1);
|
||||
.transition()
|
||||
.style('opacity', 1);
|
||||
|
||||
entered.append('div')
|
||||
.attr('class', presetClass);
|
||||
@@ -262,9 +262,7 @@ iD.ui.PresetGrid = function(context, entity) {
|
||||
.attr('class','label')
|
||||
.text(name);
|
||||
|
||||
entered.filter(function(d) {
|
||||
return !d.members;
|
||||
})
|
||||
entered.filter(function(d) { return !d.members; })
|
||||
.append('button')
|
||||
.attr('tabindex', -1)
|
||||
.attr('class', 'tag-reference-button')
|
||||
|
||||
Reference in New Issue
Block a user