Skip to content

Commit

Permalink
Enable low-zoom display of focused feature when resolving conflicts (c…
Browse files Browse the repository at this point in the history
…lose #7330)
  • Loading branch information
quincylvania committed May 18, 2020
1 parent 5071b50 commit 7b09b6c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
10 changes: 8 additions & 2 deletions modules/modes/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function modeSave(context) {

var commit = uiCommit(context)
.on('cancel', cancel);
var _conflictsUi; // uiConflicts

var _location;
var _success;
Expand Down Expand Up @@ -65,7 +66,7 @@ export function modeSave(context) {
.classed('active', true)
.classed('inactive', false);

var ui = uiConflicts(context)
_conflictsUi = uiConflicts(context)
.conflictList(conflicts)
.origChanges(origChanges)
.on('cancel', function() {
Expand All @@ -86,7 +87,7 @@ export function modeSave(context) {
uploader.processResolvedConflicts(changeset);
});

selection.call(ui);
selection.call(_conflictsUi);
}


Expand Down Expand Up @@ -199,6 +200,11 @@ export function modeSave(context) {
}


mode.selectedIDs = function() {
return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
};


mode.enter = function() {
// Show sidebar
context.ui().sidebar.expand();
Expand Down
11 changes: 9 additions & 2 deletions modules/renderer/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ export function rendererMap(context) {
var data;
var set;
var filter;
var applyFeatureLayerFilters = true;

if (map.isInWideSelection()) {
data = [];
Expand All @@ -329,6 +330,8 @@ export function rendererMap(context) {
});
fullRedraw = true;
filter = utilFunctor(true);
// selected features should always be visible, so we can skip filtering
applyFeatureLayerFilters = false;

} else if (difference) {
var complete = difference.complete(map.extent());
Expand Down Expand Up @@ -356,7 +359,11 @@ export function rendererMap(context) {
}
}

data = features.filter(data, graph);
if (applyFeatureLayerFilters) {
data = features.filter(data, graph);
} else {
context.features().resetStats();
}

if (mode && mode.id === 'select') {
// update selected vertices - the user might have just double-clicked a way,
Expand Down Expand Up @@ -1022,7 +1029,7 @@ export function rendererMap(context) {


map.isInWideSelection = function() {
return !map.withinEditableZoom() && context.mode() && context.mode().id === 'select';
return !map.withinEditableZoom() && context.selectedIDs().length;
};


Expand Down
10 changes: 10 additions & 0 deletions modules/ui/conflicts.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function uiConflicts(context) {
var keybinding = utilKeybinding('conflicts');
var _origChanges;
var _conflictList;
var _shownConflictIndex;


function keybindingOn() {
Expand Down Expand Up @@ -145,6 +146,7 @@ export function uiConflicts(context) {

function showConflict(selection, index) {
index = utilWrap(index, _conflictList.length);
_shownConflictIndex = index;

var parent = d3_select(selection.node().parentNode);

Expand Down Expand Up @@ -343,5 +345,13 @@ export function uiConflicts(context) {
};


conflicts.shownEntityIds = function() {
if (_conflictList && typeof _shownConflictIndex === 'number') {
return [_conflictList[_shownConflictIndex].id];
}
return [];
};


return utilRebind(conflicts, dispatch, 'on');
}

0 comments on commit 7b09b6c

Please sign in to comment.