mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 13:18:15 +02:00
+11
-3
@@ -24,7 +24,11 @@ import {
|
||||
} from '../actions';
|
||||
|
||||
import { coreGraph } from '../core';
|
||||
import { modeBrowse } from './index';
|
||||
|
||||
import {
|
||||
modeBrowse,
|
||||
modeSelect
|
||||
} from './index';
|
||||
|
||||
import {
|
||||
uiConflicts,
|
||||
@@ -53,8 +57,12 @@ export function modeSave(context) {
|
||||
.on('save', save);
|
||||
|
||||
|
||||
function cancel() {
|
||||
context.enter(modeBrowse(context));
|
||||
function cancel(selectedID) {
|
||||
if (selectedID) {
|
||||
context.enter(modeSelect(context, [selectedID]));
|
||||
} else {
|
||||
context.enter(modeBrowse(context));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -228,7 +228,8 @@ export function uiCommit(context) {
|
||||
|
||||
buttonSection.selectAll('.cancel-button')
|
||||
.on('click.cancel', function() {
|
||||
dispatch.call('cancel');
|
||||
var selectedID = commitChanges.entityID();
|
||||
dispatch.call('cancel', this, selectedID);
|
||||
});
|
||||
|
||||
buttonSection.selectAll('.save-button')
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
|
||||
|
||||
export function uiCommitChanges(context) {
|
||||
var _entityID;
|
||||
var detected = utilDetect();
|
||||
|
||||
|
||||
@@ -91,7 +92,7 @@ export function uiCommitChanges(context) {
|
||||
items
|
||||
.on('mouseover', mouseover)
|
||||
.on('mouseout', mouseout)
|
||||
.on('click', zoomToEntity);
|
||||
.on('click', click);
|
||||
|
||||
|
||||
// Download changeset link
|
||||
@@ -144,17 +145,27 @@ export function uiCommitChanges(context) {
|
||||
}
|
||||
|
||||
|
||||
function zoomToEntity(change) {
|
||||
var entity = change.entity;
|
||||
if (change.changeType !== 'deleted' &&
|
||||
context.graph().entity(entity.id).geometry(context.graph()) !== 'vertex') {
|
||||
function click(change) {
|
||||
if (change.changeType === 'deleted') {
|
||||
_entityID = null;
|
||||
} else {
|
||||
var entity = change.entity;
|
||||
_entityID = change.entity.id;
|
||||
context.map().zoomTo(entity);
|
||||
context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph()))
|
||||
context.surface().selectAll(utilEntityOrMemberSelector([_entityID], context.graph()))
|
||||
.classed('hover', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
commitChanges.entityID = function(_) {
|
||||
if (!arguments.length) return _entityID;
|
||||
_entityID = _;
|
||||
return commitChanges;
|
||||
};
|
||||
|
||||
|
||||
|
||||
return commitChanges;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user