Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change feature editor close X to check mark #2877

Merged
merged 6 commits into from
Dec 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ button.save.has-count .count::before {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
padding: 20px;
padding: 20px 20px 20px 40px;
}

.header button,
Expand All @@ -571,12 +571,19 @@ button.save.has-count .count::before {
height: 100%;
}

.preset-list-pane .header button {
.entity-editor-pane .header button.preset-close,
.preset-list-pane .header button.preset-choose {
position: absolute;
right: 0;
top: 0;
}

.entity-editor-pane .header button.preset-choose {
position: absolute;
left: 0;
top: 0;
}

.preset-choose {
font-size: 16px;
line-height: 1.25;
Expand Down
27 changes: 13 additions & 14 deletions data/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -692,37 +692,36 @@ en:
drag: "The main map area shows OpenStreetMap data on top of a background. You can navigate by dragging and scrolling, just like any web map. **Drag the map!**"
select: "Map features are represented three ways: using points, lines or areas. All features can be selected by clicking on them. **Click on the point to select it.**"
header: "The header shows us the feature type."
pane: "When a feature is selected, the feature editor is displayed. The header shows us the feature type and the main pane shows the feature's attributes, such as its name and address. **Close the feature editor with the close button in the top right.**"
pane: "When a feature is selected, the feature editor is displayed. The header shows us the feature type and the main pane shows the feature's attributes, such as its name and address. **Close the feature editor by pressing the {button} button in the top right.**"
points:
title: "Points"
add: "Points can be used to represent features such as shops, restaurants and monuments. They mark a specific location, and describe what's there. **Click the Point button to add a new point.**"
place: "Click to place the point on the map. The point we are adding is a Cafe. **Place the point at the corner of This Street and That Street**"
place: "The point can be placed by clicking on the map. **Place the point on top of the building.**"
add: "Points can be used to represent features such as shops, restaurants, and monuments. They mark a specific location, and describe what's there. **Click the {button} Point button to add a new point.**"
place: "The point can be placed by clicking on the map. **Click the map to place the new point on top of the building.**"
search: "There are many different features that can be represented by points. The point you just added is a Cafe. **Search for '{name}'**"
choose: "**Choose Cafe from the list.**"
describe: "The point is now marked as a cafe. Using the feature editor, we can add more information about the feature. **Add a name**"
close: "The feature editor can be closed by clicking on the close button. **Close the feature editor**"
reselect: "Often points will already exist, but have mistakes or be incomplete. We can edit existing points. **Select the point you just created.**"
fixname: "**Change the name and close the feature editor.**"
reselect_delete: "All features on the map can be deleted. **Click on the point you created.**"
delete: "The menu around the point contains operations that can be performed on it, including delete. **Delete the point.**"
close: "The feature editor will remember all of your changes automatically. When you change a feature, the close button will change to a checkmark. **Click the {button} button to close the feature editor**"
reselect: "Often points will already exist, but have mistakes or be incomplete. We can edit existing points. **Click to select the point you just created.**"
fixname: "**Change the name, then click the {button} button to close the feature editor.**"
reselect_delete: "All features on the map can be deleted. **Click to select the point you created.**"
delete: "The menu around the point contains operations that can be performed on it, including delete. **Click on the {button} button to delete the point.**"
areas:
title: "Areas"
add: "Areas are used to show the boundaries of features like lakes, buildings, and residential areas. They can be also be used for more detailed mapping of many features you might normally map as points. **Click the Area button to add a new area.**"
corner: "Areas are drawn by placing nodes that mark the boundary of the area. **Place the starting node on one of the corners of the playground.**"
add: "Areas are used to show the boundaries of features like lakes, buildings, and residential areas. They can be also be used for more detailed mapping of many features you might normally map as points. **Click the {button} Area button to add a new area.**"
corner: "Areas are drawn by placing nodes that mark the boundary of the area. **Click to place a starting node on one of the corners of the playground.**"
place: "Draw the area by placing more nodes. Finish the area by clicking on the starting node. **Draw an area for the playground.**"
search: "**Search for '{name}'.**"
choose: "**Choose Playground from the list.**"
describe: "**Add a name, and close the feature editor**"
describe: "**Add a name, then click the {button} button to close the feature editor**"
lines:
title: "Lines"
add: "Lines are used to represent features such as roads, railroads and rivers. **Click the Line button to add a new line.**"
add: "Lines are used to represent features such as roads, railroads, and rivers. **Click the {button} Line button to add a new line.**"
start: "**Start the line by clicking on the end of the road.**"
intersect: "Click to add more nodes to the line. You can drag the map while drawing if necessary. Roads, and many other types of lines, are part of a larger network. It is important for these lines to be connected properly in order for routing applications to work. **Click on Flower Street, to create an intersection connecting the two lines.**"
finish: "Lines can be finished by clicking on the last node again. **Finish drawing the road.**"
road: "**Select Road from the list**"
residential: "There are different types of roads, the most common of which is Residential. **Choose the Residential road type**"
describe: "**Name the road and close the feature editor.**"
describe: "**Name the road, then click the {button} button to close the feature editor.**"
restart: "The road needs to intersect Flower Street."
"wrong_preset": "You didn't select the Residential road type. **Click here to choose again**"
startediting:
Expand Down
26 changes: 13 additions & 13 deletions dist/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -516,39 +516,39 @@
"drag": "The main map area shows OpenStreetMap data on top of a background. You can navigate by dragging and scrolling, just like any web map. **Drag the map!**",
"select": "Map features are represented three ways: using points, lines or areas. All features can be selected by clicking on them. **Click on the point to select it.**",
"header": "The header shows us the feature type.",
"pane": "When a feature is selected, the feature editor is displayed. The header shows us the feature type and the main pane shows the feature's attributes, such as its name and address. **Close the feature editor with the close button in the top right.**"
"pane": "When a feature is selected, the feature editor is displayed. The header shows us the feature type and the main pane shows the feature's attributes, such as its name and address. **Close the feature editor by pressing the {button} button in the top right.**"
},
"points": {
"title": "Points",
"add": "Points can be used to represent features such as shops, restaurants and monuments. They mark a specific location, and describe what's there. **Click the Point button to add a new point.**",
"place": "The point can be placed by clicking on the map. **Place the point on top of the building.**",
"add": "Points can be used to represent features such as shops, restaurants, and monuments. They mark a specific location, and describe what's there. **Click the {button} Point button to add a new point.**",
"place": "The point can be placed by clicking on the map. **Click the map to place the new point on top of the building.**",
"search": "There are many different features that can be represented by points. The point you just added is a Cafe. **Search for '{name}'**",
"choose": "**Choose Cafe from the list.**",
"describe": "The point is now marked as a cafe. Using the feature editor, we can add more information about the feature. **Add a name**",
"close": "The feature editor can be closed by clicking on the close button. **Close the feature editor**",
"reselect": "Often points will already exist, but have mistakes or be incomplete. We can edit existing points. **Select the point you just created.**",
"fixname": "**Change the name and close the feature editor.**",
"reselect_delete": "All features on the map can be deleted. **Click on the point you created.**",
"delete": "The menu around the point contains operations that can be performed on it, including delete. **Delete the point.**"
"close": "The feature editor will remember all of your changes automatically. When you change a feature, the close button will change to a checkmark. **Click the {button} button to close the feature editor**",
"reselect": "Often points will already exist, but have mistakes or be incomplete. We can edit existing points. **Click to select the point you just created.**",
"fixname": "**Change the name, then click the {button} button to close the feature editor.**",
"reselect_delete": "All features on the map can be deleted. **Click to select the point you created.**",
"delete": "The menu around the point contains operations that can be performed on it, including delete. **Click on the {button} button to delete the point.**"
},
"areas": {
"title": "Areas",
"add": "Areas are used to show the boundaries of features like lakes, buildings, and residential areas. They can be also be used for more detailed mapping of many features you might normally map as points. **Click the Area button to add a new area.**",
"corner": "Areas are drawn by placing nodes that mark the boundary of the area. **Place the starting node on one of the corners of the playground.**",
"add": "Areas are used to show the boundaries of features like lakes, buildings, and residential areas. They can be also be used for more detailed mapping of many features you might normally map as points. **Click the {button} Area button to add a new area.**",
"corner": "Areas are drawn by placing nodes that mark the boundary of the area. **Click to place a starting node on one of the corners of the playground.**",
"place": "Draw the area by placing more nodes. Finish the area by clicking on the starting node. **Draw an area for the playground.**",
"search": "**Search for '{name}'.**",
"choose": "**Choose Playground from the list.**",
"describe": "**Add a name, and close the feature editor**"
"describe": "**Add a name, then click the {button} button to close the feature editor**"
},
"lines": {
"title": "Lines",
"add": "Lines are used to represent features such as roads, railroads and rivers. **Click the Line button to add a new line.**",
"add": "Lines are used to represent features such as roads, railroads, and rivers. **Click the {button} Line button to add a new line.**",
"start": "**Start the line by clicking on the end of the road.**",
"intersect": "Click to add more nodes to the line. You can drag the map while drawing if necessary. Roads, and many other types of lines, are part of a larger network. It is important for these lines to be connected properly in order for routing applications to work. **Click on Flower Street, to create an intersection connecting the two lines.**",
"finish": "Lines can be finished by clicking on the last node again. **Finish drawing the road.**",
"road": "**Select Road from the list**",
"residential": "There are different types of roads, the most common of which is Residential. **Choose the Residential road type**",
"describe": "**Name the road and close the feature editor.**",
"describe": "**Name the road, then click the {button} button to close the feature editor.**",
"restart": "The road needs to intersect Flower Street.",
"wrong_preset": "You didn't select the Residential road type. **Click here to choose again**"
},
Expand Down
7 changes: 6 additions & 1 deletion js/id/modes/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ iD.modes.Select = function(context, selectedIDs) {
}
}

function ret() {
context.enter(iD.modes.Browse(context));
}


behaviors.forEach(function(behavior) {
context.install(behavior);
Expand All @@ -157,7 +161,8 @@ iD.modes.Select = function(context, selectedIDs) {
operations.unshift(iD.operations.Delete(selectedIDs, context));

keybinding
.on('⎋', function() { context.enter(iD.modes.Browse(context)); }, true)
.on('⎋', ret, true)
.on('↩', ret, true)
.on('space', toggleMenu);

operations.forEach(function(operation) {
Expand Down
51 changes: 39 additions & 12 deletions js/id/ui/entity_editor.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
iD.ui.EntityEditor = function(context) {
var event = d3.dispatch('choose'),
var dispatch = d3.dispatch('choose'),
state = 'select',
coalesceChanges = false,
modified = false,
base,
id,
preset,
reference;
Expand All @@ -18,18 +21,21 @@ iD.ui.EntityEditor = function(context) {
.data([0]);

// Enter

var $enter = $header.enter().append('div')
.attr('class', 'header fillL cf');

$enter.append('button')
.attr('class', 'fl preset-reset preset-choose')
.append('span')
.html('◄');

$enter.append('button')
.attr('class', 'fr preset-close')
.call(iD.svg.Icon('#icon-close'));
.call(iD.svg.Icon(modified ? '#icon-apply' : '#icon-close'));

$enter.append('h3');

// Update

$header.select('h3')
.text(t('inspector.edit'));

Expand All @@ -42,7 +48,6 @@ iD.ui.EntityEditor = function(context) {
.data([0]);

// Enter

$enter = $body.enter().append('div')
.attr('class', 'inspector-body');

Expand Down Expand Up @@ -78,11 +83,10 @@ iD.ui.EntityEditor = function(context) {

selection.selectAll('.preset-reset')
.on('click', function() {
event.choose(preset);
dispatch.choose(preset);
});

// Update

$body.select('.preset-list-item button')
.call(iD.ui.PresetIcon()
.geometry(context.geometry(id))
Expand Down Expand Up @@ -121,9 +125,15 @@ iD.ui.EntityEditor = function(context) {

function historyChanged() {
if (state === 'hide') return;

var entity = context.hasEntity(id);
if (!entity) return;

entityEditor.preset(context.presets().match(entity, context.graph()));

var head = context.history().difference();
entityEditor.modified(base && !_.isEqual(base.changes(), head.changes()));

entityEditor(selection);
}

Expand Down Expand Up @@ -175,17 +185,31 @@ iD.ui.EntityEditor = function(context) {
return out;
}

function changeTags(changed) {
// Tag changes that fire on input can all get coalesced into a single
// history operation when the user leaves the field. #2342
function changeTags(changed, onInput) {
var entity = context.entity(id),
annotation = t('operations.change_tags.annotation'),
tags = clean(_.extend({}, entity.tags, changed));

if (!_.isEqual(entity.tags, tags)) {
context.perform(
iD.actions.ChangeTags(id, tags),
t('operations.change_tags.annotation'));
if (coalesceChanges) {
context.overwrite(iD.actions.ChangeTags(id, tags), annotation);
} else {
context.perform(iD.actions.ChangeTags(id, tags), annotation);
}
}

coalesceChanges = !!onInput;
}

entityEditor.modified = function(_) {
if (!arguments.length) return modified;
modified = _;
d3.selectAll('button.preset-close use')
.attr('xlink:href', (modified ? '#icon-apply' : '#icon-close'));
};

entityEditor.state = function(_) {
if (!arguments.length) return state;
state = _;
Expand All @@ -196,6 +220,9 @@ iD.ui.EntityEditor = function(context) {
if (!arguments.length) return id;
id = _;
entityEditor.preset(context.presets().match(context.entity(id), context.graph()));
entityEditor.modified(false);
base = context.history().difference();
coalesceChanges = false;
return entityEditor;
};

Expand All @@ -209,5 +236,5 @@ iD.ui.EntityEditor = function(context) {
return entityEditor;
};

return d3.rebind(entityEditor, event, 'on');
return d3.rebind(entityEditor, dispatch, 'on');
};
17 changes: 8 additions & 9 deletions js/id/ui/intro.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
iD.ui.intro = function(context) {

var step;

function intro(selection) {

context.enter(iD.modes.Browse(context));

// Save current map state
Expand All @@ -17,6 +15,9 @@ iD.ui.intro = function(context) {
baseEntities = context.history().graph().base().entities,
introGraph;

// Block saving
context.inIntro(true);

// Load semi-real data used in intro
context.connection().toggle(false).flush();
context.history().reset();
Expand All @@ -28,12 +29,6 @@ iD.ui.intro = function(context) {
context.history().merge(d3.values(iD.Graph().load(introGraph).entities));
context.background().bing();

// Block saving
var savebutton = d3.select('#bar button.save'),
save = savebutton.on('click');
savebutton.on('click', null);
context.inIntro(true);

d3.select('.background-layer').style('opacity', 1);

var curtain = d3.curtain();
Expand Down Expand Up @@ -67,7 +62,6 @@ iD.ui.intro = function(context) {
context.map().centerZoom(center, zoom);
window.location.replace(hash);
context.inIntro(false);
d3.select('#bar button.save').on('click', save);
});

var navwrap = selection.append('div').attr('class', 'intro-nav-wrap fillD');
Expand Down Expand Up @@ -136,3 +130,8 @@ iD.ui.intro.pad = function(box, padding, context) {
height: (box.width || 0) + 2 * padding
};
};

iD.ui.intro.icon = function(name, svgklass) {
return '<svg class="icon ' + (svgklass || '') + '">' +
'<use xlink:href="' + name + '"></use></svg>';
};
Loading