Make view extent include both local and remote versions of the change

This commit is contained in:
Bryan Housel
2015-04-27 10:16:47 -04:00
parent c10b83f28f
commit 00c0641f06
2 changed files with 22 additions and 7 deletions
+9 -4
View File
@@ -409,10 +409,15 @@ iD.Map = function(context) {
}
};
map.trimmedExtent = function() {
var headerY = 60, footerY = 30, pad = 10;
return new iD.geo.Extent(projection.invert([pad, dimensions[1] - footerY - pad]),
projection.invert([dimensions[0] - pad, headerY + pad]));
map.trimmedExtent = function(_) {
if (!arguments.length) {
var headerY = 60, footerY = 30, pad = 10;
return new iD.geo.Extent(projection.invert([pad, dimensions[1] - footerY - pad]),
projection.invert([dimensions[0] - pad, headerY + pad]));
} else {
var extent = iD.geo.Extent(_);
map.centerZoom(extent.center(), map.trimmedExtentZoom(extent));
}
};
function calcZoom(extent, dim) {
+13 -3
View File
@@ -198,17 +198,27 @@ iD.ui.Conflicts = function(context) {
.selectAll('input')
.property('checked', function(d) { return d === datum; });
var extent = iD.geo.Extent(),
entity;
entity = context.graph().hasEntity(datum.id);
if (entity) extent._extend(entity.extent(context.graph()));
datum.action();
zoomToEntity(datum.id);
entity = context.graph().hasEntity(datum.id);
if (entity) extent._extend(entity.extent(context.graph()));
zoomToEntity(datum.id, extent);
}
function zoomToEntity(id) {
function zoomToEntity(id, extent) {
context.surface().selectAll('.hover')
.classed('hover', false);
var entity = context.graph().hasEntity(id);
if (entity) {
context.map().zoomTo(entity);
context.map().trimmedExtent(extent);
context.surface().selectAll(
iD.util.entityOrMemberSelector([entity.id], context.graph()))
.classed('hover', true);