mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-31 04:09:33 +02:00
Do not focus text fields after initial placement
This commit is contained in:
@@ -19,7 +19,7 @@ iD.modes.AddPoint = function() {
|
||||
iD.actions.AddNode(node),
|
||||
'added a point');
|
||||
|
||||
controller.enter(iD.modes.Select(node));
|
||||
controller.enter(iD.modes.Select(node, true));
|
||||
});
|
||||
|
||||
map.keybinding().on('⎋.addpoint', function() {
|
||||
|
||||
@@ -43,7 +43,7 @@ iD.modes.DrawArea = function(wayId) {
|
||||
if (datum.id === tailId || datum.id === headId) {
|
||||
if (way.nodes.length > 3) {
|
||||
history.undo();
|
||||
controller.enter(iD.modes.Select(way));
|
||||
controller.enter(iD.modes.Select(way, true));
|
||||
} else {
|
||||
// Areas with less than 3 nodes gets deleted
|
||||
history.replace(iD.actions.DeleteWay(way.id));
|
||||
@@ -94,7 +94,7 @@ iD.modes.DrawArea = function(wayId) {
|
||||
function ret() {
|
||||
d3.event.preventDefault();
|
||||
history.replace(iD.actions.DeleteNode(node.id));
|
||||
controller.enter(iD.modes.Select(way));
|
||||
controller.enter(iD.modes.Select(way, true));
|
||||
}
|
||||
|
||||
surface
|
||||
|
||||
@@ -48,7 +48,7 @@ iD.modes.DrawLine = function(wayId, direction) {
|
||||
iD.actions.AddWayNode(wayId, tailId, index),
|
||||
'added to a line');
|
||||
|
||||
controller.enter(iD.modes.Select(way));
|
||||
controller.enter(iD.modes.Select(way, true));
|
||||
|
||||
} else {
|
||||
history.replace(iD.actions.DeleteWay(way.id));
|
||||
@@ -59,7 +59,7 @@ iD.modes.DrawLine = function(wayId, direction) {
|
||||
// finish the way
|
||||
history.undo();
|
||||
|
||||
controller.enter(iD.modes.Select(way));
|
||||
controller.enter(iD.modes.Select(way, true));
|
||||
|
||||
} else if (datum.type === 'node' && datum.id !== node.id) {
|
||||
// connect the way to an existing node
|
||||
@@ -71,13 +71,14 @@ iD.modes.DrawLine = function(wayId, direction) {
|
||||
controller.enter(iD.modes.DrawLine(wayId, direction));
|
||||
|
||||
} else if (datum.type === 'way' || datum.midpoint) {
|
||||
var choice;
|
||||
// connect the way to an existing way
|
||||
if (datum.midpoint) {
|
||||
// if clicked on midpoint
|
||||
datum.id = datum.way;
|
||||
choice = datum;
|
||||
} else {
|
||||
var choice = iD.util.geo.chooseIndex(datum, d3.mouse(surface.node()), map);
|
||||
choice = iD.util.geo.chooseIndex(datum, d3.mouse(surface.node()), map);
|
||||
}
|
||||
|
||||
history.replace(
|
||||
@@ -120,7 +121,7 @@ iD.modes.DrawLine = function(wayId, direction) {
|
||||
function ret() {
|
||||
d3.event.preventDefault();
|
||||
history.replace(iD.actions.DeleteNode(node.id));
|
||||
controller.enter(iD.modes.Select(way));
|
||||
controller.enter(iD.modes.Select(way, true));
|
||||
}
|
||||
|
||||
function undo() {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
iD.modes.Select = function(entity) {
|
||||
iD.modes.Select = function(entity, initial) {
|
||||
var mode = {
|
||||
id: 'select',
|
||||
button: 'browse',
|
||||
entity: entity
|
||||
};
|
||||
|
||||
var inspector = iD.ui.inspector(),
|
||||
var inspector = iD.ui.inspector().initial(!!initial),
|
||||
behaviors;
|
||||
|
||||
function remove() {
|
||||
|
||||
@@ -2,6 +2,7 @@ iD.ui.inspector = function() {
|
||||
var event = d3.dispatch('changeTags', 'changeWayDirection',
|
||||
'update', 'remove', 'close', 'splitWay'),
|
||||
taginfo = iD.taginfo(),
|
||||
initial = false,
|
||||
tagList;
|
||||
|
||||
function inspector(selection) {
|
||||
@@ -194,7 +195,8 @@ iD.ui.inspector = function() {
|
||||
helpBtn.append('span')
|
||||
.attr('class', 'icon inspect');
|
||||
|
||||
if (tags.length === 1 && tags[0].key === '' && tags[0].value === '') {
|
||||
if (initial && tags.length === 1 &&
|
||||
tags[0].key === '' && tags[0].value === '') {
|
||||
focusNewKey();
|
||||
}
|
||||
|
||||
@@ -271,7 +273,7 @@ iD.ui.inspector = function() {
|
||||
event.close(entity);
|
||||
}
|
||||
|
||||
inspector.tags = function (tags) {
|
||||
inspector.tags = function(tags) {
|
||||
if (!arguments.length) {
|
||||
tags = {};
|
||||
tagList.selectAll('li').each(function() {
|
||||
@@ -286,5 +288,10 @@ iD.ui.inspector = function() {
|
||||
}
|
||||
};
|
||||
|
||||
inspector.initial = function(_) {
|
||||
initial = _;
|
||||
return inspector;
|
||||
};
|
||||
|
||||
return d3.rebind(inspector, event, 'on');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user