mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Fix non-loaded way behavior
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
## Actions
|
||||
|
||||
Actions are operations on OSM data like adding nodes, moving ways,
|
||||
and so on. They are initiated by controller states, like
|
||||
`iD.controller.ControllerState` initiates a `CreatePOIAction` and
|
||||
adds it to the undo stack.
|
||||
|
||||
## Entities
|
||||
|
||||
`iD.Entity` is the door from pure objects like `iD.Node` into a hierarchy
|
||||
of objects - it provides handling of parents, children, and so on.
|
||||
|
||||
## loaded
|
||||
|
||||
The `.loaded` member of nodes and ways is because of [relations](http://wiki.openstreetmap.org/wiki/Relation),
|
||||
which refer to elements, so we want to have real references of those
|
||||
elements, but we don't have the data yet. Thus when the Connection
|
||||
encounters a new object but has a non-loaded representation of it,
|
||||
the non-loaded version is replaced.
|
||||
@@ -102,12 +102,14 @@ circle.handle {
|
||||
}
|
||||
|
||||
.stroke.highway-footway,
|
||||
.stroke.highway-cycleway,
|
||||
.stroke.highway-steps {
|
||||
stroke: #ff6257;
|
||||
stroke-width: 3;
|
||||
stroke-dasharray: 6, 6;
|
||||
}
|
||||
.casing.highway-footway,
|
||||
.casing.highway-cycleway,
|
||||
.casing.highway-steps {
|
||||
stroke-width: 3;
|
||||
stroke: #fff;
|
||||
|
||||
+3
-13
@@ -20,20 +20,10 @@ iD.Connection = function(apiURL) {
|
||||
|
||||
function assign(obj) {
|
||||
// summary: Save an entity to the data store.
|
||||
if (obj.entityType === 'node') { // never reassign nodes
|
||||
if (!entities[obj.id]) entities[obj.id] = obj;
|
||||
} else if (obj.entityType === 'way') {
|
||||
if (!entities[obj.id]) {
|
||||
entities[obj.id] = obj;
|
||||
} else {
|
||||
/*
|
||||
for (var n = 0; n < obj.nodes.length; n++) {
|
||||
entities[obj.id].addNode(obj.nodes[n]);
|
||||
}
|
||||
*/
|
||||
}
|
||||
} else if (obj.entityType === 'relation') {
|
||||
if (obj.entityType === 'relation') {
|
||||
if (!relations[obj.id]) relations[obj.id] = obj;
|
||||
} else if (!entities[obj.id] || !entities[obj.id].loaded) {
|
||||
entities[obj.id] = obj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ iD.Way = function(id, nodes, tags, loaded) {
|
||||
};
|
||||
|
||||
iD.Way.prototype = {
|
||||
|
||||
addNode: function(node) {
|
||||
node.entity.addParent(this);
|
||||
this.nodes.push(node);
|
||||
|
||||
Reference in New Issue
Block a user