mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-25 09:34:04 +02:00
Fix behavior around adding to ways
This commit is contained in:
+1
-7
@@ -83,13 +83,6 @@ require(["dojo/_base/lang","dojo/dom-geometry","dojo/dom-class","dojo/on","dojo/
|
||||
// ----------------------------------------------------
|
||||
// Mode button handlers
|
||||
/*
|
||||
enterWayMode=function() {
|
||||
controller.setState(new iD.controller.shape.NoSelection());
|
||||
};
|
||||
|
||||
enterEditMode=function() {
|
||||
};
|
||||
|
||||
finishClicked=function() {
|
||||
controller.stepper.hide();
|
||||
};
|
||||
@@ -99,6 +92,7 @@ require(["dojo/_base/lang","dojo/dom-geometry","dojo/dom-class","dojo/on","dojo/
|
||||
};
|
||||
*/
|
||||
$('#add-place').click(function() {
|
||||
controller.setState(new iD.controller.shape.NoSelection());
|
||||
});
|
||||
|
||||
$('#add-road').click(function() {
|
||||
|
||||
@@ -39,16 +39,16 @@ declare("iD.controller.shape.NoSelection", [iD.controller.ControllerState], {
|
||||
this.controller.stepper.show().step(0);
|
||||
},
|
||||
|
||||
processMouseEvent:function(event,entityUI) {
|
||||
var entity=entityUI ? entityUI.entity : null;
|
||||
var entityType=entity ? entity.entityType : null;
|
||||
var map=this.controller.map;
|
||||
processMouseEvent:function(event, entityUI) {
|
||||
var entity = entityUI ? entityUI.entity : null;
|
||||
var entityType = entity ? entity.entityType : null;
|
||||
var map = this.controller.map;
|
||||
|
||||
if (event.type=='click') {
|
||||
if (event.type === 'click') {
|
||||
switch (entityType) {
|
||||
case 'node':
|
||||
// Click to select a node
|
||||
var ways=entity.parentWays();
|
||||
var ways = entity.parentWays();
|
||||
if (!ways.length) { return new iD.controller.shape.SelectedPOINode(entity); }
|
||||
// else { return new iD.controller.shape.SelectedWayNode(entity,ways[0]); }
|
||||
// ** FIXME: ^^^ the above should start a new branching way, not select the node
|
||||
|
||||
@@ -20,28 +20,27 @@ declare("iD.controller.shape.SelectedWay", [iD.controller.ControllerState], {
|
||||
way: null,
|
||||
wayUI: null,
|
||||
|
||||
constructor:function(_way) {
|
||||
constructor: function(way) {
|
||||
// summary: In 'Draw shape' mode, and a way is selected as the starting point of the new way.
|
||||
this.way=_way;
|
||||
this.way = way;
|
||||
},
|
||||
enterState:function() {
|
||||
this.wayUI=this.controller.map.getUI(this.way);
|
||||
this.wayUI.setStateClass('selected');
|
||||
this.wayUI.setStateClass('shownodes');
|
||||
this.wayUI.redraw();
|
||||
this.controller.stepper.setSteps({
|
||||
begin: "Click anywhere on the map to start drawing there",
|
||||
startpoint: "Click the point on the way where you want to start your new way",
|
||||
draw: "Keep clicking to add each point, and press Enter or double-click when you're done",
|
||||
tag: "Set the type of the road or shape"
|
||||
},['begin','startpoint','draw','tag']).highlight('startpoint');
|
||||
},
|
||||
exitState:function() {
|
||||
this.wayUI.resetStateClass('selected');
|
||||
this.wayUI.resetStateClass('shownodes');
|
||||
this.wayUI.redraw();
|
||||
},
|
||||
|
||||
|
||||
enterState:function() {
|
||||
this.wayUI = this.controller.map.getUI(this.way);
|
||||
this.wayUI.setStateClass('selected')
|
||||
.setStateClass('shownodes')
|
||||
.redraw();
|
||||
this.controller.stepper.message("Click the point on the way where you want to start your new way");
|
||||
return this;
|
||||
},
|
||||
|
||||
exitState:function() {
|
||||
this.wayUI.resetStateClass('selected')
|
||||
.resetStateClass('shownodes')
|
||||
.redraw();
|
||||
return this;
|
||||
},
|
||||
|
||||
processMouseEvent:function(event,entityUI) {
|
||||
var entity=entityUI ? entityUI.entity : null;
|
||||
var entityType=entity ? entity.entityType : null;
|
||||
@@ -52,8 +51,8 @@ declare("iD.controller.shape.SelectedWay", [iD.controller.ControllerState], {
|
||||
case null:
|
||||
return new iD.controller.shape.NoSelection();
|
||||
case 'node':
|
||||
var ways=entity.parentWays();
|
||||
if (entity.hasParent(this.way)) {
|
||||
var ways = entity.entity.parentWays();
|
||||
if (entity.entity.hasParent(this.way)) {
|
||||
// start a branching way from an existing point
|
||||
way = this.getConnection().doCreateWay({}, [entity], lang.hitch(this,this.undoAdder) );
|
||||
this.controller.map.createUI(way);
|
||||
|
||||
@@ -17,6 +17,15 @@ declare("iD.ui.StepPane", null, {
|
||||
// ---------------------------
|
||||
// Change the highlighted step
|
||||
|
||||
message: function(x) {
|
||||
this.show();
|
||||
$('<div></div>')
|
||||
.appendTo('#road-help')
|
||||
.attr('class', 'manual')
|
||||
.text(x);
|
||||
return this;
|
||||
},
|
||||
|
||||
step: function(x) {
|
||||
// summary: Highlight the step with the specified name, and dim all others.
|
||||
this.show();
|
||||
@@ -30,6 +39,7 @@ declare("iD.ui.StepPane", null, {
|
||||
// summary: Show the window.
|
||||
$('#road-help').show();
|
||||
$('#road-help div').hide();
|
||||
$('#road-help .manual').remove();
|
||||
return this;
|
||||
},
|
||||
hide: function() {
|
||||
|
||||
Reference in New Issue
Block a user