suppressMenu(true) is now the default

This commit is contained in:
Bryan Housel
2017-02-21 15:47:22 -05:00
parent d8237fa3eb
commit e756520bd8
15 changed files with 31 additions and 42 deletions

View File

@@ -246,9 +246,7 @@ export function behaviorDrawWay(context, wayId, index, mode, baseGraph) {
}, 1000);
if (context.hasEntity(wayId)) {
context.enter(
modeSelect(context, [wayId]).suppressMenu(true).newFeature(true)
);
context.enter(modeSelect(context, [wayId]).newFeature(true));
} else {
context.enter(modeBrowse(context));
}

View File

@@ -23,8 +23,8 @@ export function behaviorSelect(context) {
function click() {
var rtClick = d3.event.type === 'contextmenu';
var rtClick = d3.event.type === 'contextmenu';
if (rtClick) {
d3.event.preventDefault();
}
@@ -40,21 +40,21 @@ export function behaviorSelect(context) {
context.enter(modeBrowse(context));
} else if (!d3.event.shiftKey && !lasso) {
// Reselect when 'rtClick on one of the selectedIDs'
// Reselect when 'rtClick on one of the selectedIDs'
// OR 'leftClick on the same singular selected entity'
// Explanation: leftClick should discard any multiple
// selection of entities and make the selection singlular.
// Whereas rtClick should preserve multiple selection of
// Whereas rtClick should preserve multiple selection of
// entities if and only if it clicks on one of the selectedIDs.
if (context.selectedIDs().indexOf(datum.id) >= 0
&& (rtClick || context.selectedIDs().length === 1)) {
if (context.selectedIDs().indexOf(datum.id) >= 0 &&
(rtClick || context.selectedIDs().length === 1)) {
mode.suppressMenu(false).reselect();
} else {
context.enter(modeSelect(context, [datum.id]));
}
} else if (context.selectedIDs().indexOf(datum.id) >= 0) {
if (rtClick) { // To prevent datum.id from being removed when rtClick
mode.suppressMenu(false).reselect();
mode.suppressMenu(false).reselect();
} else {
var selectedIDs = _.without(context.selectedIDs(), datum.id);
context.enter(selectedIDs.length ? modeSelect(context, selectedIDs) : modeBrowse(context));

View File

@@ -32,7 +32,7 @@ export function modeAddPoint(context) {
);
context.enter(
modeSelect(context, [node.id]).suppressMenu(true).newFeature(true)
modeSelect(context, [node.id]).newFeature(true)
);
}

View File

@@ -222,7 +222,7 @@ export function modeDragNode(context) {
});
if (reselection.length) {
context.enter(modeSelect(context, reselection).suppressMenu(true));
context.enter(modeSelect(context, reselection));
} else {
context.enter(modeBrowse(context));
}

View File

@@ -115,7 +115,7 @@ export function modeMove(context, entityIDs, baseGraph) {
function finish() {
d3.event.stopPropagation();
context.enter(modeSelect(context, entityIDs).suppressMenu(true));
context.enter(modeSelect(context, entityIDs));
stopNudge();
}
@@ -126,7 +126,7 @@ export function modeMove(context, entityIDs, baseGraph) {
context.enter(modeBrowse(context));
} else {
context.pop();
context.enter(modeSelect(context, entityIDs).suppressMenu(true));
context.enter(modeSelect(context, entityIDs));
}
stopNudge();
}

View File

@@ -92,13 +92,13 @@ export function modeRotate(context, entityIDs) {
function finish() {
d3.event.stopPropagation();
context.enter(modeSelect(context, entityIDs).suppressMenu(true));
context.enter(modeSelect(context, entityIDs));
}
function cancel() {
context.pop();
context.enter(modeSelect(context, entityIDs).suppressMenu(true));
context.enter(modeSelect(context, entityIDs));
}

View File

@@ -56,7 +56,7 @@ export function modeSelect(context, selectedIDs) {
inspector,
editMenu,
newFeature = false,
suppressMenu = false,
suppressMenu = true,
follow = false;
@@ -154,14 +154,9 @@ export function modeSelect(context, selectedIDs) {
} else {
var point = context.mouse(),
viewport = geoExtent(context.projection.clipExtent()).polygon();
// offset = [
// viewport[2][0] - point[0],
// (viewport[1][1] - 30) - point[1] // 30 to account for the infoblock
// ];
if (geoPointInPolygon(point, viewport)) {
editMenu.center(point);
// .offset(offset);
}
}
}
@@ -249,6 +244,7 @@ export function modeSelect(context, selectedIDs) {
d3.event.preventDefault();
d3.event.stopPropagation();
} else if (datum.type === 'midpoint') {
context.perform(
actionAddMidpoint({loc: datum.loc, edge: datum.edge}, osmNode()),
@@ -310,7 +306,7 @@ export function modeSelect(context, selectedIDs) {
if (parent) {
var way = context.entity(parent);
context.enter(
modeSelect(context, [way.first()]).follow(true).suppressMenu(true)
modeSelect(context, [way.first()]).follow(true)
);
}
}
@@ -322,7 +318,7 @@ export function modeSelect(context, selectedIDs) {
if (parent) {
var way = context.entity(parent);
context.enter(
modeSelect(context, [way.last()]).follow(true).suppressMenu(true)
modeSelect(context, [way.last()]).follow(true)
);
}
}
@@ -346,7 +342,7 @@ export function modeSelect(context, selectedIDs) {
if (index !== -1) {
context.enter(
modeSelect(context, [way.nodes[index]]).follow(true).suppressMenu(true)
modeSelect(context, [way.nodes[index]]).follow(true)
);
}
}
@@ -370,7 +366,7 @@ export function modeSelect(context, selectedIDs) {
if (index !== -1) {
context.enter(
modeSelect(context, [way.nodes[index]]).follow(true).suppressMenu(true)
modeSelect(context, [way.nodes[index]]).follow(true)
);
}
}

View File

@@ -44,9 +44,7 @@ export function operationDelete(selectedIDs, context) {
context.perform(action, operation.annotation());
if (nextSelectedID && context.hasEntity(nextSelectedID)) {
context.enter(
modeSelect(context, [nextSelectedID]).follow(true).suppressMenu(true)
);
context.enter(modeSelect(context, [nextSelectedID]).follow(true));
} else {
context.enter(modeBrowse(context));
}

View File

@@ -30,7 +30,7 @@ export function operationMerge(selectedIDs, context) {
var entity = context.hasEntity(id);
return entity && entity.type !== 'node';
});
context.enter(modeSelect(context, ids).suppressMenu(true));
context.enter(modeSelect(context, ids));
};

View File

@@ -77,7 +77,7 @@ export function rendererMap(context) {
if (Array.isArray(stack.selectedIDs)) {
followSelected = (stack.selectedIDs.length === 1 && stack.selectedIDs[0][0] === 'n');
context.enter(
modeSelect(context, stack.selectedIDs).suppressMenu(true).follow(followSelected)
modeSelect(context, stack.selectedIDs).follow(followSelected)
);
}
if (!followSelected && stack.transform) {

View File

@@ -274,9 +274,7 @@ export function uiCommit(context) {
function warningClick(d) {
if (d.entity) {
context.map().zoomTo(d.entity);
context.enter(
modeSelect(context, [d.entity.id]).suppressMenu(true)
);
context.enter(modeSelect(context, [d.entity.id]));
}
}
@@ -286,8 +284,7 @@ export function uiCommit(context) {
if (change.changeType !== 'deleted' &&
context.graph().entity(entity.id).geometry(context.graph()) !== 'vertex') {
context.map().zoomTo(entity);
context.surface().selectAll(
utilEntityOrMemberSelector([entity.id], context.graph()))
context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph()))
.classed('hover', true);
}
}

View File

@@ -265,7 +265,7 @@ export function uiFeatureList(context) {
edge = geoChooseEdge(context.childNodes(d.entity), center, context.projection);
context.map().center(edge.loc);
}
context.enter(modeSelect(context, [d.entity.id]).suppressMenu(true));
context.enter(modeSelect(context, [d.entity.id]));
} else {
context.zoomToEntity(d.id);
}

View File

@@ -17,7 +17,7 @@ export function uiRawMemberEditor(context) {
function selectMember(d) {
d3.event.preventDefault();
context.enter(modeSelect(context, [d.id]).suppressMenu(true));
context.enter(modeSelect(context, [d.id]));
}

View File

@@ -25,7 +25,7 @@ export function uiRawMembershipEditor(context) {
function selectRelation(d) {
d3.event.preventDefault();
context.enter(modeSelect(context, [d.relation.id]).suppressMenu(true));
context.enter(modeSelect(context, [d.relation.id]));
}
@@ -55,7 +55,7 @@ export function uiRawMembershipEditor(context) {
t('operations.add.annotation.relation')
);
context.enter(modeSelect(context, [relation.id]).suppressMenu(true));
context.enter(modeSelect(context, [relation.id]));
}
}

View File

@@ -9,7 +9,7 @@ import { utilDisplayName } from '../util/index';
export function uiSelectionList(context, selectedIDs) {
function selectEntity(entity) {
context.enter(modeSelect(context, [entity.id]).suppressMenu(true));
context.enter(modeSelect(context, [entity.id]));
}
@@ -19,7 +19,7 @@ export function uiSelectionList(context, selectedIDs) {
if (index > -1) {
selectedIDs.splice(index, 1);
}
context.enter(modeSelect(context, selectedIDs).suppressMenu(true));
context.enter(modeSelect(context, selectedIDs));
}